コード例 #1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (this.tag == "LineFallSlowRailGun")
     {
         if (collision.tag == "PlayerShield")
         {
             player.DamageToShieldForLineFallMissile();
             PublicValueStorage.Instance.AddMissileScore();
         }
     }
 }
コード例 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        //Debug.Log("Name : BOSSMissile - " +  collision.tag);
        if (this.tag == "Missile")
        {
            this.gameObject.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));

            if (collision.tag == "WasteBasket")
            {
                Destroy(this.gameObject);
            }
            switch (collision.tag)
            {
            case "Player":
                //case "WasteBasket":
                //Debug.Log("If Player : " +collision.tag);
                Instantiate(missileExplosion, this.transform.position, Quaternion.identity);
                PublicValueStorage.Instance.GetPlayerComponent().ActivatePlayerDie();
                Destroy(this.gameObject);
                break;

            case "PlayerShield":
                this.tag  = "PlayerMissile";
                this.name = "PlayerMissile";
                //enemyTrail.enabled = true;
                //missileColor.color = Color.blue;
                //Debug.Log(missileColor);
                //GameManager.Instance.ScoreAdd("Missile");
                ControllerPlayer tempPlayer = PublicValueStorage.Instance.GetPlayerComponent();
                PublicValueStorage.Instance.AddMissileScore();
                tempPlayer.OP_DamageToPlayerShield(missileShieldBreakPercent);
                tempPlayer.DamageToShieldForLineFallMissile();
                direction            = opCurves.SeekDirection(this.gameObject.transform.position, parentPos);
                missileCurrentSpeed *= missileReflectSpeed;
                break;
            }
        }

        else if (this.tag == "PlayerMissile")
        {
            if (collision.tag == "WasteBasket")
            {
                Destroy(this.gameObject);
            }
            switch (collision.tag)
            {
            case "Enemy":
            case "BOSS":
                Instantiate(missileExplosion, this.transform.position, Quaternion.identity);
                Destroy(this.gameObject);
                break;
            }
        }
    }