コード例 #1
0
 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;
     }
 }
コード例 #2
0
 // 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;
 }
コード例 #3
0
 public virtual void Stationary()
 {
     is_floating          = false;
     states               = floatingStates.bottom;
     doorRenderer.enabled = true;
     doorCollider.enabled = true;
     audioSource.PlayOneShot(close, volume);
 }
コード例 #4
0
 public virtual void Floating()
 {
     is_floating          = true;
     states               = floatingStates.goUp;
     doorRenderer.enabled = false;
     doorCollider.enabled = false;
     audioSource.PlayOneShot(open, volume);
 }
コード例 #5
0
 public virtual void FloatingRight()
 {
     is_floating          = false;
     states               = floatingStates.moving;
     direction            = 3;
     doorRenderer.enabled = true;
     doorCollider.enabled = true;
     audioSource.PlayOneShot(close, volume);
 }
コード例 #6
0
 public virtual void FloatingForward()
 {
     is_floating          = true;
     states               = floatingStates.moving;
     direction            = 1;
     doorRenderer.enabled = false;
     doorCollider.enabled = false;
     audioSource.PlayOneShot(open, volume);
 }