コード例 #1
0
 private new void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag.Equals("Sword") && sword.damaging)
     {
         isHurt = true;
         hitpointBar.DecreaseBossHitpoint(sword.damage);
     }
 }
コード例 #2
0
    private new void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag.Equals("Laser"))
        {
            if (!light.enabled)
            {
                light.enabled = true;
            }
            hitpointBar.DecreaseBossHitpoint(1);
        }

        if (collision.gameObject.name == "Player")
        {
            Vector2 forceDirection = new Vector2(facingDirection.x, 1.0f);
            player.GetComponent <Rigidbody2D>().AddForce(forceDirection, ForceMode2D.Impulse);
            playerBar.DecreaseHitpoint(1);
        }
    }
コード例 #3
0
ファイル: Boss.cs プロジェクト: PinMeister/Swiss-Army-Swords
 private void OnTriggerStay2D(Collider2D col)
 {
     if (col.tag == "Sword" && sword.damaging && !isInvulnerable)
     {
         isHurt = true;
         hitpointBar.DecreaseBossHitpoint(2);
         isInvulnerable = true;
     }
 }
コード例 #4
0
    private new void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag.Equals("Sword") && sword.damaging && !isDark)
        {
            isHurt = true;
            hitpointBar.DecreaseBossHitpoint(sword.damage);
        }

        if (col.tag.Equals("Laser") && isDark)
        {
            isDark = false;
            TurnIntoNormalMode();
        }
    }