예제 #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;
        }
    }