public void FSM() { if (states == floatingStates.goUp) { newPos = top.position; transform.position = Vector3.Lerp(transform.position, newPos, smooth * Time.deltaTime); if (transform.position == top.position) { states = floatingStates.goDown; } } if (states == floatingStates.goDown) { newPos = bottom.position; transform.position = Vector3.Lerp(transform.position, newPos, smooth * Time.deltaTime); if (transform.position == bottom.position) { states = floatingStates.bottom; } } if (states == floatingStates.bottom) { transform.position = bottom.position; } }
// Start is called before the first frame update public virtual void Start() { count = 0; doorRenderer = GetComponent <MeshRenderer>(); doorCollider = GetComponent <BoxCollider>(); audioSource = GetComponent <AudioSource>(); states = floatingStates.pause; }
public virtual void Stationary() { is_floating = false; states = floatingStates.bottom; doorRenderer.enabled = true; doorCollider.enabled = true; audioSource.PlayOneShot(close, volume); }
public virtual void Floating() { is_floating = true; states = floatingStates.goUp; doorRenderer.enabled = false; doorCollider.enabled = false; audioSource.PlayOneShot(open, volume); }
public virtual void FloatingRight() { is_floating = false; states = floatingStates.moving; direction = 3; doorRenderer.enabled = true; doorCollider.enabled = true; audioSource.PlayOneShot(close, volume); }
public virtual void FloatingForward() { is_floating = true; states = floatingStates.moving; direction = 1; doorRenderer.enabled = false; doorCollider.enabled = false; audioSource.PlayOneShot(open, volume); }