示例#1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("PlayerBullet") || other.CompareTag("EnemyBullet"))
     {
         BulletPulling.Enqueue(other.transform);
     }
 }
示例#2
0
 private void FixedUpdate()
 {
     // Debug.Log("BulletScript Updating");
     if (liveTime > 0)
     {
         // Debug.Log("BulletScript if pass");
         transform.Translate(Vector3.forward * Time.deltaTime * speed, Space.Self);
         liveTime -= Time.deltaTime;
     }
     else
     {
         BulletPulling.Enqueue(transform);
     }
 }
示例#3
0
    public IEnumerator Attacking()
    {
        WaitForSeconds waiting = new WaitForSeconds(1);
        float          atkAngle;

        while (true)
        {
            Debug.Log("Player is targeting" + targetEnemy.name);
            if (enemies.Count > 0)
            {
                atkAngle           = Mathf.Atan2(transform.position.z - targetEnemy.transform.position.z, transform.position.x - targetEnemy.transform.position.x) * Mathf.Rad2Deg;
                transform.rotation = Quaternion.Euler(0, atkAngle, 0);
                // transform.LookAt(targetEnemy.transform);
                BulletPulling.Dequeue(transform);
            }
            yield return(waiting);
        }
    }
示例#4
0
    private void OnTriggerEnter(Collider other)
    {
        switch (other.gameObject.tag)
        {
        case "EnemyBullet":
            BulletPulling.Enqueue(other.transform);
            Damage();
            break;

        case "Enemy":
            Damage();
            break;

        case "Food":
            LevelUp();
            other.gameObject.SetActive(false);
            break;

        default: break;
        }
    }
示例#5
0
 public override void Attack(GameObject target)
 {
     PlayerComponent.transform.LookAt(target.transform.position);
     BulletPulling.Dequeue(PlayerComponent.transform);
 }
示例#6
0
 protected void Attacked(float power, GameObject obj)
 {
     BulletPulling.Enqueue(obj.transform);
     hp -= power;
 }
 protected void Attack()
 {
     BulletPulling.Dequeue(transform);
 }