コード例 #1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (CPlayer._skillOn != true)
        {
            if (collider.tag == "SHOOT")
            {
                _shoot.SetActive(false);
                _skilldie = false;
                _enemyHit.SetActive(true);
                CShoot hitDamage = collider.GetComponent <CShoot>();
                _hp += (10 * CGameManager._balance);                 // 게임매니저 난이도 밸런스 적용.
                _hp -= (hitDamage._damage * CPlayer._playerBalance); // 플레이어 레벨업 밸런스 적용.
                CGameManager._comboCount += 1;
                CGameManager._comboSucess = true;
                _comboImage = GameObject.Find("Combo").transform.FindChild("ComboImage").GetComponent <CUIDissable>();
                _comboImage.SetActiveMe();
                CGameManager._ComboResetCount = 3.5f;
                _animator.SetBool("EnemyDamaged", true);

                if (collider.transform.position.x > gameObject.transform.position.x)
                {
                    transform.Translate(-Vector2.right * 0.4f);
                }
                else
                {
                    transform.Translate(Vector2.right * 0.4f);
                }
            }

            if (collider.tag == "SKILLFIRE")
            {
                _shoot.SetActive(false);
                _skilldie = true;
                _enemyHit.SetActive(true);
                CSkillFire hitSkillDamage = collider.GetComponent <CSkillFire>();
                _hp *= CGameManager._balance;                             // 게임매니저 난이도 밸런스 적용.
                _hp -= (hitSkillDamage._damage * CPlayer._playerBalance); // 플레이어 레벨업 밸런스 적용.

                if (collider.transform.position.x > gameObject.transform.position.x)
                {
                    transform.Translate(-Vector2.right * 1.2f);
                }
                else
                {
                    transform.Translate(Vector2.right * 1.2f);
                }
            }
        }
    }
コード例 #2
0
ファイル: CEnemy.cs プロジェクト: ifpi98/GhostSword
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (CPlayer._skillOn != true)
        {
            if (collider.tag == "SHOOT")
            {
                _shoot.SetActive(false);
                _skilldie = false;
                _enemyHit.SetActive(true);
                CShoot hitDamage = collider.GetComponent<CShoot>();
                _hp += (10 * CGameManager._balance); // 게임매니저 난이도 밸런스 적용.
                _hp -= (hitDamage._damage * CPlayer._playerBalance); // 플레이어 레벨업 밸런스 적용.
                CGameManager._comboCount += 1;
                CGameManager._comboSucess = true;
                _comboImage = GameObject.Find("Combo").transform.FindChild("ComboImage").GetComponent<CUIDissable>();
                _comboImage.SetActiveMe();
                CGameManager._ComboResetCount = 3.5f;
                _animator.SetBool("EnemyDamaged", true);

                if (collider.transform.position.x > gameObject.transform.position.x)
                {
                    transform.Translate(-Vector2.right * 0.4f);
                }
                else
                {
                    transform.Translate(Vector2.right * 0.4f);
                }
            }

            if (collider.tag == "SKILLFIRE")
            {
                _shoot.SetActive(false);
                _skilldie = true;
                _enemyHit.SetActive(true);
                CSkillFire hitSkillDamage = collider.GetComponent<CSkillFire>();
                _hp *= CGameManager._balance; // 게임매니저 난이도 밸런스 적용.
                _hp -= (hitSkillDamage._damage * CPlayer._playerBalance); // 플레이어 레벨업 밸런스 적용.

                if (collider.transform.position.x > gameObject.transform.position.x)
                {
                    transform.Translate(-Vector2.right * 1.2f);
                }
                else
                {
                    transform.Translate(Vector2.right * 1.2f);
                }
            }
        }
    }