Exemple #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag.Equals("AttackSensor"))
        {
            var monster = other.attachedRigidbody.GetComponent <MonsterControll>();
            monster.Attack(true);
        }

        if (other.tag.Equals("WarningSensor"))
        {
            var monster = other.attachedRigidbody.GetComponent <MonsterControll>();
            monster.LookAround(true);
        }

        if (other.tag.Equals("MonsterBullet"))
        {
            var attackEffectController = other.attachedRigidbody.GetComponent <AttackEffectController>();
            attackEffectController.Hit();

            HurtFront = (characterCommon.FacingRight != attackEffectController.FacingRight);

            characterCommon.Hurt();
        }

        if (other.tag.Equals("CaveEnd"))
        {
            var levelManager = GameData.Instance.LevelManager;
            if (levelManager.IsLastLevel)
            {
                levelManager.Reset();
            }
            rigid2D.isKinematic = true;
            var levelInit = PresentData.Instance.LevelInit;
            levelInit.Load();
        }
    }
Exemple #2
0
 public void Hurt()
 {
     characterCommon.Hurt();
 }