Ejemplo n.º 1
0
        public static int GetUnitAttackTargetScore(BattleCore _battleCore, bool _isMine, int _id, int _pos, int _turrentScore, int _baseScore)
        {
            int score = 0;

            IUnitSDS unitSDS = BattleCore.GetUnitData(_id);

            for (int i = 0; i < unitSDS.GetPos().Length; i++)
            {
                int pos = _pos + unitSDS.GetPos()[i];

                ITurrentSDS turrentSDS = unitSDS.GetTurrent()[i];

                List <int> result = GetTurrentAttackTargetList(_battleCore, _isMine, turrentSDS, pos);

                if (result != null)
                {
                    for (int m = 0; m < result.Count; m++)
                    {
                        int targetPos = result[m];

                        if (targetPos < 0)
                        {
                            score += _baseScore;
                        }
                        else
                        {
                            score += _turrentScore;
                        }
                    }
                }
            }

            return(score);
        }
Ejemplo n.º 2
0
        public void Init(BattleCore _battleCore, bool _isMine, IUnitSDS _sds, int _uid, int _pos, int _time)
        {
            battleCore = _battleCore;

            isMine = _isMine;

            sds = _sds;

            uid = _uid;

            pos = _pos;

            hp = sds.GetHp();

            state = UnitState.CD;

            if (sds.GetLiveTime() > 0)
            {
                dieTime = _time + sds.GetLiveTime();
            }

            Turrent[] turrentPos = isMine ? battleCore.mTurrent : battleCore.oTurrent;

            for (int i = 0; i < sds.GetPos().Length; i++)
            {
                int posFix = sds.GetPos()[i];

                ITurrentSDS turrentSDS = sds.GetTurrent()[i];

                Turrent turrent = new Turrent();

                turrent.Init(battleCore, this, turrentSDS, pos + posFix, _time);

                turrentPos[pos + posFix] = turrent;

                turrentList.Add(turrent);
            }
        }