Ejemplo n.º 1
0
 public AttackData(MechaComponentInfo attackerMCI, MechaComponent hitterMcb, int decHp, BattleTipType battleTipType, int elementType, int elementHp)
 {
     AttackerMCI   = attackerMCI;
     HitterMCB     = hitterMcb;
     DecHp         = decHp;
     BattleTipType = battleTipType;
     ElementType   = elementType;
     ElementHP     = elementHp;
 }
 public UIBattleTipInfo(uint hitMcbGuid, BattleTipType battleTipType, AttackerType attackerType, int diffHp, int elementHp, float scale, int elementType,
                        string spriteImagePath, Vector3 startPos, Vector2 offset, Vector2 randomRange, float disappearTime)
 {
     HitMCB_GUID     = hitMcbGuid;
     BattleTipType   = battleTipType;
     AttackerType    = attackerType;
     DiffHP          = diffHp;
     ElementHP       = elementHp;
     Scale           = scale;
     ElementType     = elementType;
     SpriteImagePath = spriteImagePath;
     StartPos        = startPos;
     Offset          = offset;
     RandomRange     = randomRange;
     DisappearTime   = disappearTime;
 }
        private AttackerType GetAttackerType(MechaInfo attacker, MechaInfo hitter, BattleTipType battleTipType)
        {
            //不走攻击类型判定
            if ((int)battleTipType > (int)BattleTipType.NoAttackSeparate)
            {
                return(AttackerType.None);
            }

            if (attacker != null)
            {
                //主角
                if (attacker.IsPlayer)
                {
                    if (hitter.IsPlayer)
                    {
                        return(AttackerType.LocalPlayerSelfDamage);
                    }
                    else
                    {
                        return(AttackerType.LocalPlayer);
                    }
                }

                //同个阵营
                if (hitter != null && attacker.IsFriend(hitter))
                {
                    return(AttackerType.NoTip);
                }

                //队友
                if (attacker.IsMainPlayerFriend())
                {
                    return(AttackerType.Team);
                }

                //敌人
                if (hitter != null && attacker.IsOpponent(hitter))
                {
                    return(AttackerType.Enemy);
                }
            }

            return(AttackerType.None);
        }
        private void HandleCommonTip(uint mcGUID, BattleTipType battleTipType)
        {
            if (!EnableUIBattleTip)
            {
                return;
            }
            if ((int)battleTipType >= (int)BattleTipType.FollowDummySeparate)
            {
                return;
            }

            AttackerType attackerType = AttackerType.None;

            MechaComponent mc_owner = ClientBattleManager.Instance.FindMechaComponent(mcGUID);

            if (ClientBattleManager.Instance.PlayerMecha != null && mc_owner != null)
            {
                attackerType = GetAttackerType(mc_owner.Mecha.MechaInfo, ClientBattleManager.Instance.PlayerMecha.MechaInfo, battleTipType);
            }

            if (attackerType == AttackerType.NoTip)
            {
                return;
            }

            UIBattleTipInfo info = new UIBattleTipInfo(
                0,
                battleTipType,
                attackerType,
                0,
                0,
                0.13f,
                0,
                "",
                mc_owner.transform.position + Vector3.up * 1f,
                Vector2.zero,
                Vector2.one,
                0.5f);

            CreateTip(info);
        }