示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Debug.Log(name + " hited " + collision.name);
     InGameLog.LogFunc(name + " hited " + collision.name);
     if (collision.CompareTag("EnemyBullet"))
     {
         Bullet bullet = collision.GetComponent <Bullet>();
         if (HealthPoint <= 0)
         {
             Instantiate(DeadExplosion, transform.position, Quaternion.identity);
             Destroy(gameObject);
             return;
         }
         Instantiate(HitedExplosion, collision.transform.position, Quaternion.identity);
         Destroy(collision.gameObject);
         HealthPoint -= bullet.BulletDamage;
     }
 }
示例#2
0
    public void ConsolCommand(string command)
    {
        switch (command)
        {
        case "spawn player":
            Instantiate(player, new Vector3(-6f, 0f, 0f), Quaternion.identity);
            InGameLog.LogFunc("Execute : " + command);
            break;

        case "spawn enemy":
            Instantiate(enemey, new Vector3(6f, 0f, 0f), Quaternion.identity);
            InGameLog.LogFunc("Execute : " + command);
            break;

        default:
            InGameLog.LogFunc("It's not correct Command");
            break;
        }
    }