示例#1
0
 private void Update()
 {
     countTime += Time.deltaTime;
     if (shotInterval <= countTime)
     {
         esm.Shot();
         countTime = 0f;
     }
 }
示例#2
0
 private void Update()
 {
     if (Physics.Raycast(this.transform.position, turret.transform.position - head.transform.position, out hit, 50f))
     {
         if (hit.collider.gameObject.CompareTag("Player"))
         {
             esm.Shot();
         }
     }
 }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        countTime += Time.deltaTime;
        if (countTime > checkInterval)
        {
            if (ec.GetRaycastToPlayer().transform.CompareTag("Player"))
            {
                toPlayerNotWall = true;
            }
            else
            {
                toPlayerNotWall = false;
            }
        }

        if (toPlayerNotWall)
        {
            cannon.transform.LookAt(target.transform);
        }
        else
        {
            ec.TurnCannonAdd(1f);
        }

        if (countTime > checkInterval)
        {
            try
            {
                if (toPlayerNotWall)
                {
                    esm.Shot();
                }
                else if (ec.GetRaycastCannon(bulletBounceNum).transform.root.CompareTag("Player"))
                {
                    esm.Shot();
                }
            }catch (Exception e)
            {
                Debug.Log(e);
            }
            countTime = 0f;
        }
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        countTime += Time.deltaTime;
        if (countTime >= 2f)
        {
            //Debug.Log(ec.GetRaycastCannon(2).collider.gameObject);
            if (ec.GetRaycastHit().transform.CompareTag("Player"))
            {
                esm.Shot();
            }

            countTime = 0f;
        }
    }