| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.PlayerLoop;
- public class FanActivationScript : MonoBehaviour
- {
- public Transform FanKnobTransform1;
- public Transform FanKnobTransform2;
- public Transform FanKnobTransform3;
- public List<Transform> FanaList1;
- public List<Transform> FanaList2;
- public List<Transform> FanaList3;
- public float Speed;
- public bool isOpen1 = true;
- public bool isOpen2 = false;
- public bool isOpen3 = false;
- void FixedUpdate()
- {
- if (isOpen1)
- {
- for (int i = 0; i < FanaList1.Count; i++)
- {
- Vector3 rotation = FanaList1[i].eulerAngles;
- rotation.z += Speed;
- FanaList1[i].eulerAngles = rotation;
- }
- }
- if (isOpen2)
- {
- for (int i = 0; i < FanaList2.Count; i++)
- {
- Vector3 rotation = FanaList2[i].eulerAngles;
- rotation.z += Speed;
- FanaList2[i].eulerAngles = rotation;
- }
- }
- if (isOpen3)
- {
- for (int i = 0; i < FanaList3.Count; i++)
- {
- Vector3 rotation = FanaList3[i].eulerAngles;
- rotation.z += Speed;
- FanaList3[i].eulerAngles = rotation;
- }
- }
- }
- public void isOpenFanList1()
- {
- isOpen1 = !isOpen1;
- }
- public void isOpenFanList2()
- {
- isOpen2 = !isOpen2;
- }
- public void isOpenFanList3()
- {
- isOpen3 = !isOpen3;
- }
- }
|