コード例 #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
    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;
        }
    }
コード例 #4
0
 protected void Attacked(float power, GameObject obj)
 {
     BulletPulling.Enqueue(obj.transform);
     hp -= power;
 }