Inheritance: MonoBehaviour
Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.gameObject.tag == "Player")
        {
            ReceiveDamage RD = collider.gameObject.GetComponent <ReceiveDamage>();
            collider.gameObject.GetComponent <playerdata>().RpcUpdateScore(100);


            Debug.Log("got Found by player");
            Destroy(gameObject);
        }
        if (collider.gameObject.tag == "Bullet")
        {
            Bullet bullet = collider.gameObject.GetComponent <Bullet>();

            ReceiveDamage RD = bullet.owner.GetComponent <ReceiveDamage>();


            bullet.owner.GetComponent <playerdata>().RpcUpdateScore(100);


            Debug.Log("got hit by bullet");
            Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
    private void Awake()
    {
        int count1 = 0;
        int count2 = 0;
        int count3 = 0;

        GameObject[] gameObjects = FindObjectsOfType <GameObject>();

        for (int j = 0; j < gameObjects.Length; ++j)
        {
            ReceiveDamage  receiveDamage  = gameObjects[j].GetComponent <ReceiveDamage>();
            AttackCollider attackCollider = gameObjects[j].GetComponent <AttackCollider>();
            CharacterMove  characterMove  = gameObjects[j].GetComponent <CharacterMove>();

            if (receiveDamage)
            {
                count1++;
            }

            if (attackCollider != null)
            {
                count2++;
            }

            if (characterMove)
            {
                count3++;
            }
        }

        Debug.Log("ReceiveDamage의 갯수: " + count1);
        Debug.Log("AttackCollider의 갯수: " + count2);
        Debug.Log("CharacterMove의 갯수: " + count3);
    }
Exemplo n.º 3
0
    protected virtual void OnTriggerEnter2D(Collider2D collision)
    {
        if (longDamage)
        {
            return;
        }

        if (collision.CompareTag(m_sTagName))
        {
            ReceiveDamage receiveDamage = collision.gameObject.GetComponent <ReceiveDamage>();

            if (receiveDamage.bScriptEnable != false)
            {
                if (attackForce != Vector2.zero)
                {
                    receiveDamage.AddDamageForce(attackForce);
                }
                receiveDamage.Receive(m_damage, false);
            }

            if (autoDistroy)
            {
                ObjectPool.Inst.PushToPool(this.gameObject);
            }
        }
    }
Exemplo n.º 4
0
    protected virtual void OnTriggerStay2D(Collider2D collision)
    {
        if (!longDamage)
        {
            return;
        }

        currntTime += Time.deltaTime;
        if (currntTime < damageSpaceTime)
        {
            return;
        }
        else
        {
            currntTime = 0;
        }

        if (collision.CompareTag(m_sTagName))
        {
            ReceiveDamage receiveDamage = collision.gameObject.GetComponent <ReceiveDamage>();

            if (receiveDamage.bScriptEnable != false)
            {
                if (attackForce != Vector2.zero)
                {
                    receiveDamage.AddDamageForce(attackForce);
                }
                receiveDamage.Receive(m_damage, false);
            }
        }
    }
Exemplo n.º 5
0
 void Start()
 {
     rD = GetComponent<ReceiveDamage> ();
     tL = GetComponent<TurtleLoop> ();
     powerUp = (GameObject)Resources.Load ("Prefabs/PowerUpBubble");
     playerLayer = (gameObject.layer == 9);
 }
Exemplo n.º 6
0
    protected override void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag(m_sTagName))
        {
            ReceiveDamage receiveDamage = collision.gameObject.GetComponent <ReceiveDamage>();
            if (receiveDamage.bScriptEnable != false)
            {
                if (attackForce != Vector2.zero)
                {
                    receiveDamage.AddDamageForce(attackForce);
                    m_cinemachineImpulse.GenerateImpulse();
                }

                if (m_playerInfo.IsCritical())
                {
                    m_damage = (int)((m_damage * 1.5f) + 0.5f);
                    receiveDamage.Receive(m_damage, true);
                }
                else
                {
                    receiveDamage.Receive(m_damage, false);
                }

                if (!m_playerState.IsPlayerGround())
                {
                    m_playerInfo.PlusAirAttackCount();
                }
                m_playerCombo.plusCombo();
            }
        }
    }
Exemplo n.º 7
0
 protected virtual void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag(m_sTagName))
     {
         ReceiveDamage receiveDamage = collision.gameObject.GetComponent <ReceiveDamage>();
         if (receiveDamage.enabled != false)
         {
             if (attackForce != Vector2.zero)
             {
                 receiveDamage.AddDamageForce(attackForce);
             }
             receiveDamage.Receive(m_damage, false);
         }
     }
 }
Exemplo n.º 8
0
    public void AddDamageEvent(GameObject character, GameObject damager)
    {
        eventCount++;

        if (LayerMask.LayerToName(damager.layer) == "Enemy" || LayerMask.LayerToName(damager.layer) == "Collider")
        {
            string enemy = damager.transform.parent?.gameObject.name;
            if (damager.GetComponent <Spit>() != null)
            {
                enemy = "Spitter";
            }

            ReceiveDamage newEvent = new ReceiveDamage(character.transform.position, eventCount, enemy);
            damagedList.Add(newEvent);
            Debug.Log(newEvent.GetJson());
        }
    }
Exemplo n.º 9
0
    protected override void OnTriggerEnter2D(Collider2D collision)
    {
        //if(longDamage)
        if (m_hited)
        {
            return;
        }

        if (collision.tag == m_sTagName)
        {
            ReceiveDamage receiveDamage = collision.gameObject.GetComponent <ReceiveDamage>();

            if (!receiveDamage.bScriptEnable)
            {
                return;
            }

            if (attackForce != Vector2.zero)
            {
                receiveDamage.AddDamageForce(attackForce);
                m_cinemachineImpulse.GenerateImpulse();
            }

            if (m_monsterInfo.IsCritical())
            {
                m_damage = (int)((m_damage * 1.5f) + 0.5f);
                receiveDamage.Receive(m_damage, true);
            }
            else
            {
                receiveDamage.Receive(m_damage, false);
            }

            if (autoDistroy)
            {
                ObjectPool.Inst.PushToPool(this.gameObject);
            }
        }
        if (collision.tag == "Floor")
        {
            StartCoroutine(m_projectile.InGround());
        }
    }
Exemplo n.º 10
0
    void InitMonsterInfo()
    {
        MonsterInfo.MonsterCharInfo monsterCharInfo;
        if (StageDataManager.Inst.nowStage == StageDataManager.StageNameEnum.STAGE_1_1)
        {
            monsterCharInfo.level          = 1;
            monsterCharInfo.maxHp          = 300;
            monsterCharInfo.defensive      = 10;
            monsterCharInfo.attack         = 70;
            monsterCharInfo.attackDistance = 2.5f;
            monsterCharInfo.speed          = 5.0f;
            m_monsterInfo = GetComponent <MonsterInfo>();
            m_monsterInfo.SetInfo(monsterCharInfo);
        }
        else if (StageDataManager.Inst.nowStage == StageDataManager.StageNameEnum.STAGE_1_2)
        {
            monsterCharInfo.level          = 1;
            monsterCharInfo.maxHp          = 700;
            monsterCharInfo.defensive      = 10;
            monsterCharInfo.attack         = 150;
            monsterCharInfo.attackDistance = 2.5f;
            monsterCharInfo.speed          = 5.0f;
            m_monsterInfo = GetComponent <MonsterInfo>();
            m_monsterInfo.SetInfo(monsterCharInfo);
        }
        m_monsterMove   = GetComponent <MonsterMove>();
        m_monsterAttack = GetComponent <MonsterAttack>();
        m_animFunction  = transform.GetComponentInChildren <AnimFuntion>();
        m_receiveDamage = GetComponent <ReceiveDamage>();
        m_monsterHpBar  = GetComponentInChildren <MonsterHpBar>();

        m_monsterPosition = Monster_Position.Monster_Position_Ground;

        m_monsterMove.SetSpeed(m_monsterInfo.speed);
        m_bLive = true;
    }
Exemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     vidaEnemy = GetComponentInParent <ReceiveDamage>();
 }
Exemplo n.º 12
0
    public void checkHp()
    {
        ReceiveDamage RD = GetComponent <ReceiveDamage>();

        updateHealth(RD.getHealth());
    }
Exemplo n.º 13
0
 private void Awake()
 {
     m_characterMove = this.GetComponent <CharacterMove>();
     m_characterJump = this.GetComponent <CharacterJump>();
     m_receiveDamage = this.GetComponent <ReceiveDamage>();
 }