コード例 #1
0
        private void Rez()//Only "Player" can "Rez()". Which means only "Player" have special action in the process of "hit->Revive"
        {
            //Should immune the damage for short period of time
            //But I haven't got time to do that
            //Therefore, for now, if Player was hitted when it was just revived, game will be exited right way because all its lives had been consumed by the logic loop in "BoardLogic(int X, int Y)".
            JustRevived = true;
            Score      /= Lives;
            Timer.Start();
            Vector2 origin = new Vector2((graphic.PreferredBackBufferWidth - Size.X) / 2, graphic.PreferredBackBufferHeight - Size.Y);

            if (Position.X != origin.X || Position.Y != origin.Y)
            {
                this.UpdatePosition(origin);
            }
        }
コード例 #2
0
 public void Start(GameTime gameTime)
 {
     //called in Game().Update()
     if (!started)
     {
         started = true;
         Timer.Start();
     }
     if (Timer.TimeUp(gameTime))
     {
         i += .1;
     }
     i = Math.Round(i, 1); // i should be 0.59999 or 2.0000002, so should round to .1th
     if (Schedule.ContainsKey(i))
     {
         Schedule[i]();
         Schedule.Remove(i);
     }
 }
コード例 #3
0
 public Player(Texture2D I, Vector2 S = default(Vector2), int _Lives = 1, Vector2 V = default(Vector2), IBehaviors b = null) : base(I, S, b, default(Vector2), _Lives, V)
 {
     ScoreTimer.Start();
     JustRevived = false;
     this.UpdatePosition(new Vector2((graphic.PreferredBackBufferWidth - Size.X) / 2, graphic.PreferredBackBufferHeight - Size.Y));
 }