示例#1
0
 public Controller(PlayerIndex player, BaseUnit unit)
 {
     this.unit = unit;
     this.player = player;
     currentState = GamePad.GetState(this.player);
     if (currentState.IsConnected == true) { usingGamePad = true; }
 }
示例#2
0
        internal void Collide(BaseUnit other)
        {
            // try using p=mv to conserve momentum, mmmmkay?
            Vector2 diff = other.position - this._position;
            this._position -= diff;

            //this._velocity.X *= (float)-0.5;
            //this._velocity.Y *= (float)-0.5;

            this._velocity = this._velocity * ((this.mass - other.mass) / (this.mass + other.mass));
            other._velocity = this._velocity * (this._velocity * (this.mass * 2) / (this.mass + other.mass));

            this._life -= (int) (velocity.Length() + other.velocity.Length());
        }