예제 #1
0
    // Update is called once per frame
    void Update()
    {
        switch (CurrentState)
        {
        case mortorState.idle:
            break;

        case mortorState.shoot:

            if (Time.time > nextTimeFire)
            {
                if (target_ != null)
                {
                    Vector3 vo = Calculatevelocity(target_.transform.position, firePoint.position, speed);
                    shoot(vo);
                    nextTimeFire = Time.time + gameObject.GetComponent <towerInf>().fireRate;
                }
                else
                {
                    CurrentState = mortorState.idle;
                }
            }
            break;
        }
    }
예제 #2
0
 public void stopShoot()
 {
     CurrentState = mortorState.idle;
     target_      = null;
 }
예제 #3
0
 public void shoot(GameObject targetGameObject)
 {
     CurrentState = mortorState.shoot;
     target_      = targetGameObject;
 }