コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (leader.GetFSM().CurrentState() == leader.States.WalkingState && lastLeaderState != leader.States.WalkingState)
     {
         audiosource_walk.Play();
     }
     else if (lastLeaderState == leader.States.WalkingState && leader.GetFSM().CurrentState() != leader.States.WalkingState)
     {
         audiosource_walk.Stop();
     }
     lastLeaderState = leader.GetFSM().CurrentState();
 }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     audiosource_walk = this.transform.GetComponent <AudioSource>();
     leader           = GameObject.FindGameObjectWithTag(Tags.Leader).GetComponent <Leader>();
     lastLeaderState  = leader.GetFSM().CurrentState();
 }