Exemple #1
0
        public void MoveAngle(short moveAngle)
        {
            //Logger.LogInfo ("进入到移动状态");
            int        speed   = mUnit.GetAttribute(FighterAttributeType.Speed);
            IntVector2 stopPos = IntVector2.MoveAngle(mUnit.Position, moveAngle, speed);

            stopPos = LimitPos(stopPos);

            IntVector2 fromPos = mUnit.Position;

            mUnit.Position = stopPos;
            OnPosChanged(fromPos);
            //Logger.LogError("移动 " + fromPos.ToString() + " " + mUnit.Position);
            BattleLogManager.Instance.Log("DoInBattle", BattleTimeLine.Instance.CurFrameCount + " " + mUnit.ID + " Move " + moveAngle);
        }
Exemple #2
0
        public void ChangeUnitAttr(UnitBase targetUnit, FighterAttributeType attrType, int chgValue)
        {
            if (targetUnit.IsDead)
            {
                return;
            }
            Debug.Log("技能效果生效 目標:" + targetUnit.ID + " 傷害:" + attrType);
            int preValue = targetUnit.GetAttribute(attrType);

            preValue += chgValue;
            if (attrType == FighterAttributeType.Life && preValue <= 0)
            {
                BattleUnitManager.Instance.OnUnitDead(targetUnit.ID);
            }
            else
            {
                targetUnit.SetAttribute(attrType, preValue);
            }
            mAttrChgListener.Invoke(targetUnit.ID, attrType, preValue);
        }