コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        switch (CurrentState)
        {
        case xbowState.idle:
            break;

        case xbowState.shoot:
            if (Time.time > nextTimeFire)
            {
                if (target_ != null)
                {
                    shoot();
                    nextTimeFire = Time.time + gameObject.GetComponent <towerInf>().fireRate;
                }
                else
                {
                    CurrentState = xbowState.idle;
                }
            }
            break;
        }
    }
コード例 #2
0
 public void stopShoot()
 {
     CurrentState = xbowState.idle;
     target_      = null;
 }
コード例 #3
0
 public void shoot(GameObject targetGameObject)
 {
     CurrentState = xbowState.shoot;
     target_      = targetGameObject;
     rotation();
 }