//START FAN private void Clutching() { if (starting) { if (!fanStart.isPlaying) { CurrentFanState = FanState.Active; starting = false; Running(); } } else { fanStart.Stop(); CurrentFanState = FanState.Off; } DesiredRPM = FanIdleRPM; }
// Use this for initialization void Start() { rubeBall = FindObjectOfType <RubeBall>().gameObject; rubeBallRB = rubeBall.GetComponent <Rigidbody>(); fanBehaviour = FindObjectOfType <FanBehaviour>(); if (fanBehaviour == null) { fanBehaviour = (FanBehaviour)ScriptableObject.CreateInstance(typeof(FanBehaviour)); } previousFanState = fanBehaviour.fanState; if (fanBehaviour.fanState == FanState.Suck) { suckSource.Play(); } else { blowSource.Play(); } }
// Update is called once per frame void Update() { if (fanBehaviour.fanState == FanState.Suck) { if (previousFanState == FanState.Blow) { blowSource.Stop(); suckSource.Play(); } this.GetComponentInChildren <Transform>().Rotate(Vector3.forward * Time.deltaTime * fanSpeed); previousFanState = fanBehaviour.fanState; } else { if (previousFanState == FanState.Suck) { suckSource.Stop(); blowSource.Play(); } this.GetComponentInChildren <Transform>().Rotate(Vector3.back * Time.deltaTime * fanSpeed); previousFanState = fanBehaviour.fanState; } }
public CeilingFan(string name) : base(name) { _speed = FanState.Off; }
public void Off() { LogAction(GetCaller()); _speed = FanState.Off; }
public void Low() { LogAction(GetCaller()); _speed = FanState.Low; }
public void Medium() { LogAction(GetCaller()); _speed = FanState.Medium; }
public void High() { LogAction(GetCaller()); _speed = FanState.High; }
public void Execute() { _previousSpeed = _ceilingFan.GetSpeed(); _ceilingFan.High(); }