private void OnTriggerEnter(Collider other) { if (other.CompareTag("PlayerBullet") || other.CompareTag("EnemyBullet")) { BulletPulling.Enqueue(other.transform); } }
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); } }
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); } }
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; } }
public override void Attack(GameObject target) { PlayerComponent.transform.LookAt(target.transform.position); BulletPulling.Dequeue(PlayerComponent.transform); }
protected void Attacked(float power, GameObject obj) { BulletPulling.Enqueue(obj.transform); hp -= power; }
protected void Attack() { BulletPulling.Dequeue(transform); }