예제 #1
0
        protected Unit(UnitBase unitBase, Player owner)
        {
            InitAttribute(unitBase);
            this.GameCore = owner.GameCore;
            this.Team = owner.atTeam;
            this.Owner = owner;

            Owner.unit.Add(this); // TODO : Need change to Player's function

            this.GameCore.IDP.UID.ApplyID(this);
            ActionState = new UnitActionState();
            foreach (Skill s in skill)
            {
                s.Register(this);
            }
        }
예제 #2
0
 public virtual bool AttackBase(Team beAttacked)
 {
     if (CanAttackBase(beAttacked))
     {
         beAttacked.BeAttacked();
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #3
0
 public virtual bool CanAttackBase(Team beAttacked)
 {
     if (beAttacked.blood <= 0) return false;
     foreach(ChessboardCell r in beAttacked.Base)
     {
         if (CanAttack(r)) return true;
     }
     return false;
 }
예제 #4
0
 /// <summary>
 /// 生成默认队伍和玩家
 /// </summary>
 private void InitTeam()
 {
     if (_teams.Count == 0 || _players.Count == 0)
     {
         _teams.Add(new Team(this));
         _teams.Add(new Team(this));
         _teams[0].Add(new Player(Teams[0]));
         _teams[1].Add(new Player(Teams[1]));
     }
     NeutralTeam = new Team(this);
     NeutralPlayer = new Player(NeutralTeam);
 }