Example #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;
        }
    }
Example #2
0
 public void stopShoot()
 {
     CurrentState = mortorState.idle;
     target_      = null;
 }
Example #3
0
 public void shoot(GameObject targetGameObject)
 {
     CurrentState = mortorState.shoot;
     target_      = targetGameObject;
 }