Example #1
0
        public Player(int number)
        {
            this.number = number;

            // These need to be set later.
            this.ship = null;
            this.scoreCard = null;
            this.leftKey = Key.Unknown;
            this.rightKey = Key.Unknown;
            this.upKey = Key.Unknown;
            this.downKey = Key.Unknown;
            this.fireKey = Key.Unknown;

            this.leftKeyIsDown = false;
            this.rightKeyIsDown = false;
            this.upKeyIsDown = false;
            this.downKeyIsDown = false;
            this.fireKeyWasPressed = false;

            this.creationEffect = new ShipCreationEffect();
            this.explosionEffect = new ShipExplosionEffect();
        }
Example #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                // We haven't been disposed yet.

                if (disposing)
                {
                    /* The method has been called directly or indirectly by a
                     * user's code.  Dispose of managed resources here.
                     */
                    if (this.creationEffect != null)
                    {
                        this.creationEffect.Dispose();
                        this.creationEffect = null;
                    }

                    if (this.explosionEffect != null)
                    {
                        this.explosionEffect.Dispose();
                        this.explosionEffect = null;
                    }
                }

                // Dispose of unmanaged resources _only_ out here.

                this.disposed = true;
            }
        }