コード例 #1
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("enemy"))
        {
            this.enemy.Play();
            Debug.Log("enemy collider");

            this.gameController.LivesValue -= 10;
            enemyctrl c = other.GetComponent <enemyctrl>();
            c.Reset();
        }
        if (other.CompareTag("health"))
        {
            this.health.Play();
            Debug.Log("health collider");
            this.gameController.LivesValue += 10;
            enemyctrl c = other.GetComponent <enemyctrl>();
            c.Reset();
        }
        if (other.CompareTag("Rock"))
        {
            this.Rock.Play();
            Debug.Log("Rock collider");
            this.gameController.ScoreValue += 20;
            enemyctrl c = other.GetComponent <enemyctrl>();
            c.Reset();
        }
    }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     Player = transform.parent.Find("devil@attack_1").GetComponent <enemyctrl>();
 }