コード例 #1
0
    public void EmitEffectFont(GameObject thisGameObject, GameData.BattleGameData.AttackedState currentAttackState, int currentEffectFontDamage)
    {
        EmitEffectFontData emitEffectFontData = new EmitEffectFontData();

        emitEffectFontData._currBeAttackedState     = currentAttackState;
        emitEffectFontData._currentEffectFontDamage = currentEffectFontDamage;
        emitEffectFontData._thisGameObject          = thisGameObject;

        _emitBeAttackedFontDataList.Add(emitEffectFontData);
    }
コード例 #2
0
    private void EmitBeAttackedFontInvoke(EmitEffectFontData effectFontData)
    {
        GameData.BattleGameData.AttackedState currentAttackState = effectFontData._currBeAttackedState;
        GameObject gameObject = effectFontData._thisGameObject;
        int        damage     = effectFontData._currentEffectFontDamage;

        BattleBloodControl bloodControl = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattleMain>().bloodControl;

        if (bloodControl == null)
        {
            Debug.Log("bloodControl is null");
            return;
        }

        // tzz modified for Refactoring
        Vector3 worldPos = gameObject.transform.position;

        worldPos.z += FightCellSlot.EffectDamageBloodOffset;
        Vector3 offset = new Vector3(0f, 20f, 0f);

        switch (currentAttackState)
        {
        case GameData.BattleGameData.AttackedState.DODGE:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.DODGE, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.NORMAL_ATTACKED:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_GRAY, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.NORMAL_CRIT:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_RED, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.SKILL_ATTACKED:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_GRAY, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.SKILL_CRIT:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_RED, damage, "");
            break;

        case GameData.BattleGameData.AttackedState.TREAT_SKILL_ATTACKED:
        case GameData.BattleGameData.AttackedState.REDUCE_DAMAGE_SKILL_ATTACKED:
            bloodControl.EmitEffectFont(gameObject.transform, worldPos, offset, BattleEffectFont.EffectType.NUMBER_GREEN, damage, "");
            break;

        default:
            Debug.LogError("Error AttackedState EmitBeAttackedFontInvoke " + currentAttackState);
            break;
        }
    }
コード例 #3
0
    public void OnBeAttacked(SkillDataSlot skillData)
    {
        mPublisher.NotifyBeAttacked(this, skillData);

        numCurrBeAttackedPerStep++;

        // Check this warship is death
        long shipId = ShipData.roleCardId;

        SkillDataSlot.AttackTargetData beAttackData = skillData._attackTargetDataList[shipId];

        int damage = beAttackData._beAttackedDamage;

        GameData.BattleGameData.AttackedState attackedState = (GameData.BattleGameData.AttackedState)beAttackData._beAttackedState;
        if (attackedState != GameData.BattleGameData.AttackedState.DODGE)
        {
            Property.WarshipSimulateLife -= damage;

            // tzz modified for damage and cure HP
            if (Property.WarshipSimulateLife > Property.WarshipMaxLife)
            {
                Property.WarshipSimulateLife = Property.WarshipMaxLife;
            }
            // Property.WarshipSimulateLife = Mathf.Clamp(Property.WarshipSimulateLife,0,Property.WarshipMaxLife);

            if (numCurrBeAttackedPerStep == numBeAttackedPerStep)
            {
                // Reset
                numBeAttackedPerStep     = 0;
                numCurrBeAttackedPerStep = 0;

                if (Property.WarshipSimulateLife <= 0.0f)
                {
                    OnDeath();
                }
                else
                {
                    if (null != animComponent)
                    {
                        animComponent.Play("Hit", PlayMode.StopAll);
                        // animComponent.CrossFade("Hit");
                    }
                }
            }
            else
            {
                if (null != animComponent)
                {
                    animComponent.Play("Hit", PlayMode.StopAll);
                }
            }
        }
        else
        {
            if (null != animComponent)
            {
                animComponent.Play("Dodge", PlayMode.StopAll);
            }
        }

        UpdateLifeProgress((float)Property.WarshipSimulateLife);
        UpdatePowerProgress((float)Property.WarshipCurrentPower);

        //tzz added for REDUCE_DAMAGE_SKILL_ATTACKED
        //
        if (!skillData.IsReduceDamangeSkill())
        {
            if (skillData.IsCureSkill())
            {
                emitEffectFont.EmitEffectFont(gameObject, (GameData.BattleGameData.AttackedState)skillData._attckerAttackState, Mathf.Abs(damage));
            }
            else
            {
                emitEffectFont.EmitEffectFont(gameObject, attackedState, damage);
            }
        }

        // tzz added for shaking camera
        List <SkillEffectData.SkillFireParticleData> t_list = skillData._skillEffectData._skillFireParticleList;

        if (t_list.Count > 0 && t_list[t_list.Count - 1]._shakeCamera && skillData.IsNivoseType())
        {
            // iTween.ShakePosition(Globals.Instance.MSceneManager.mMainCamera.gameObject,new Vector3(20,20,0),1);

#if UNITY_IPHONE || UNITY_ANDROID
            if (GameDefines.Setting_ShakeEnable)
            {
                Handheld.Vibrate();
            }
#endif
        }
    }
コード例 #4
0
    public void OnBeAttacked(Skill skill)
    {
        _numCurrentBeAttacked += 1;

        // Check this warship is death
        SkillDataSlot.AttackTargetData beAttackData = skill._mSkillDataSlot._attackTargetDataList[this._warshipID];
        int damage = beAttackData._beAttackedDamage;

        GameData.BattleGameData.AttackedState attackedState =
            (GameData.BattleGameData.AttackedState)beAttackData._beAttackedState;

        if (attackedState != GameData.BattleGameData.AttackedState.DODGE)
        {
            Property.WarshipSimulateLife -= damage;

            // tzz modified for damage and cure HP
            if (Property.WarshipSimulateLife > Property.WarshipMaxLife)
            {
                Property.WarshipSimulateLife = Property.WarshipMaxLife;
            }
            // Property.WarshipSimulateLife = Mathf.Clamp(Property.WarshipSimulateLife,0,Property.WarshipMaxLife);

            GirlData.PropertyData.Life = Property.WarshipSimulateLife;

            float remainLifePercent = (float)Property.WarshipSimulateLife / Property.WarshipMaxLife;
            if (remainLifePercent <= 0.4f && remainLifePercent > 0.2f)
            {
                GameObject go = GetTagPointGameObject(TagPointDefine.TAG_POINT_SHIP_BREAK_DOWN);
                if (null != go)
                {
                    ActiveAttachObject(go);
                }
            }
            else if (remainLifePercent <= 0.2f && remainLifePercent > 0f)
            {
                GameObject go = GetTagPointGameObject(TagPointDefine.TAG_POINT_SHIP_DESTROY_FRONT);
                if (null != go)
                {
                    ActiveAttachObject(go);
                }
                go = GetTagPointGameObject(TagPointDefine.TAG_POINT_SHIP_DESTROY_BACK);
                if (null != go)
                {
                    ActiveAttachObject(go);
                }
            }
        }

        if (_numCurrentBeAttacked == _numBeAttacked)
        {
            _numBeAttacked        = 0;
            _numCurrentBeAttacked = 0;

            if (Property.WarshipSimulateLife <= 0.0f)
            {
                Stop();
                PlayAnimation(AnimationDefine.ANIMATION_DEAD, 1.0f, false, false);

                {
                    // Play die particle, falling into sea effect
                    GameObject go = GetTagPointGameObject(TagPointDefine.TAG_POINT_SHIP_SPRAY);
                    if (null != go)
                    {
                        ActiveAttachObject(go);
                    }
                }
            }
            else
            {
                PlayAnimation(AnimationDefine.ANIMATION_HURT, 1.0f, false, false);
            }
        }
        else
        {
            // Play be hit animation
            PlayAnimation(AnimationDefine.ANIMATION_HURT, 1.0f, false, false);
        }

        _bloodValue = (float)Property.WarshipSimulateLife / (float)Property.WarshipMaxLife;
        _bloodValue = Mathf.Clamp(_bloodValue, 0.0f, 1.0f);

        //tzz added for REDUCE_DAMAGE_SKILL_ATTACKED
        //
        if (!skill._mSkillDataSlot.IsReduceDamangeSkill())
        {
            if (skill._mSkillDataSlot.IsCureSkill())
            {
                _emitEffectFontUtil.EmitEffectFont(_thisGameObject, (GameData.BattleGameData.AttackedState)skill._mSkillDataSlot._attckerAttackState, Mathf.Abs(damage));
            }
            else
            {
                _emitEffectFontUtil.EmitEffectFont(_thisGameObject, attackedState, damage);
            }
        }

        _mEventPublisher.NotifyBeAttacked(this, skill);
        GameStatusManager.Instance.MBattleStatus.OnBeAttacked(this, skill);

        // tzz added for shaking camera
        List <SkillEffectData.SkillFireParticleData> t_list = skill._mSkillDataSlot._skillEffectData._skillFireParticleList;

        if (t_list.Count > 0 && t_list[t_list.Count - 1]._shakeCamera && skill.IsNivoseType())
        {
            iTween.ShakePosition(Globals.Instance.MSceneManager.mMainCamera.gameObject, new Vector3(20, 20, 0), 1);

#if UNITY_IPHONE || UNITY_ANDROID
            if (GameDefines.Setting_ShakeEnable)
            {
                Handheld.Vibrate();
            }
#endif
        }
    }