Esempio n. 1
0
    /// <summary>
    /// 减速检测
    /// </summary>
    private void BulletHitSlowMotionCheck(INotifyArgs args)
    {
        BulletHitData bulletHitData        = (BulletHitData)args;
        var           vocation             = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
        int           bulletId             = 0;
        var           slowMonitorCondition = m_stepItem.SlowMonitorCondition.Split('+');
        var           monsterId            = m_stepItem.SlowMonitorTarget;

        switch (vocation)
        {
        case 1:      //剑客
            bulletId = int.Parse(slowMonitorCondition[0]);
            break;

        case 4:      //刺客
            bulletId = int.Parse(slowMonitorCondition[1]);
            break;
        }
        if (bulletHitData.BulletId == bulletId && monsterId == bulletHitData.BeFightId)
        {
            RemoveEventHandler(EventTypeEnum.HitMonsterForGuide.ToString(), BulletHitSlowMotionCheck);
            if (m_stepItem != null && m_stepItem.SlowMonitorType == 1)
            {
                ClearGuideStepUIEffect();
                RefreshGuideStepUI(true);

                StartCoroutine("SlowMotionHandle");

                AddEventHandler(EventTypeEnum.FireSkillForGuide.ToString(), SlowMotionFinish);
            }
        }
    }
Esempio n. 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag(damageTag))
        {
            BulletHitData bulletHitData = new BulletHitData
            {
                damage      = this.damage,
                hitLocation = this.transform
            };

            other.SendMessage("TakeDamage", bulletHitData);
        }
        Destroy(gameObject);
    }
Esempio n. 3
0
    //public void TakeDamage(int damage)
    //{
    //    health -= damage;
    //    Quaternion newRot = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z + adjustExplosionAngle);
    //    Instantiate(explosionPrefab, transform.position, newRot);

    //    if (health <= 0)
    //    {
    //        Destroy(gameObject);
    //    }
    //}

    public void TakeDamage(BulletHitData data)
    {
        health -= data.damage;
        Quaternion newRot = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z + adjustExplosionAngle);

        Instantiate(explosionPrefab, data.hitLocation.position, newRot);

        if (health <= 0)
        {
            GetComponent <AddScore>().DoSendScore();

            Destroy(gameObject);
        }
    }