Exemplo n.º 1
0
 public Mine(Players owner, Vector2 pos, float rot, bool gold, int gridSize, Dictionary <Players, Dictionary <Resources, int> > resources)
     : base(gold ? ModelManager.GetInstance().GoldMine : ModelManager.GetInstance().Quarry,
            gold ? UnitTypes.GoldMine : UnitTypes.Quarry,
            owner, pos, rot, gridSize, GetBlockedFields(), GetPassableFields())
 {
     mTakeOverManager = new TakeOverManager(Position);
     TakeOverManager.AddMine();
     mLastTimeResource = 0;
     mResources        = resources;
     Level             = 1;
 }
Exemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            var newOwner = mTakeOverManager.Overtaking(gameTime, false);

            if (newOwner != Owner)
            {
                Level             = 1;
                mLastTimeLevelUp  = gameTime.TotalGameTime.TotalMilliseconds;
                mLastTimeResource = gameTime.TotalGameTime.TotalMilliseconds;
                TakeOverManager.TakeMineOver(Owner, newOwner);
                Owner = newOwner;
            }
            if (mLastTimeLevelUp + 60 * 2 * Level * 1000 < gameTime.TotalGameTime.TotalMilliseconds)
            {
                mLastTimeLevelUp = gameTime.TotalGameTime.TotalMilliseconds;
                if (Level < 6)
                {
                    Level++;
                }
            }
            if (mLastTimeResource + 15 * 1000 < gameTime.TotalGameTime.TotalMilliseconds)
            {
                mLastTimeResource = gameTime.TotalGameTime.TotalMilliseconds;
                if (Owner != 0)
                {
                    if (UnitType == UnitTypes.GoldMine)
                    {
                        mResources[Owner][Resources.Gold] += Level;
                        GameState.Current.StatisticsByPlayer[Owner]["Gold"] += Level;
                    }
                    else
                    {
                        mResources[Owner][Resources.Stone] += Level;
                        GameState.Current.StatisticsByPlayer[Owner]["Stone"] += Level;
                    }
                }
            }
        }
Exemplo n.º 3
0
 public SacredStar(Players owner, Vector2 pos, int gridSize)
     : base(ModelManager.GetInstance().SacredStar, UnitTypes.SacredStar, owner, pos, 0f, gridSize)
 {
     mTakeOverManager = new TakeOverManager(Position);
     mIsApplied       = false;
 }