Ejemplo n.º 1
0
        public static VectorUpdate read(BinaryReader binaryReader)
        {
            VectorUpdate newObj = new VectorUpdate();

            newObj.object_id  = binaryReader.ReadUInt32();
            newObj.velocity   = Vector3.read(binaryReader);
            newObj.omega      = Vector3.read(binaryReader);
            newObj.timestamps = PhysicsTimestampPack.read(binaryReader);
            return(newObj);
        }
        //, VectorUpdate updatePosition, VectorUpdate updateSpeed)
        public Enemy(Animation a, Vector2 position, Vector2 speed, SoundEffect death, VectorUpdate p, VectorUpdate s)
            : base(a, position, speed)
        {
            deathPlayer.PlayAnimation(DeathAnimation);
            destruction = death;
            Health = DefaultLives;

            Dying += playDeathSound;
            UpdatePosition += p;
            UpdateSpeed += s;
            OutOfBounds += (sender, args) => Dying -= playDeathSound;

            OnSpawn(new GameEventArgs(GameCore.Time));
        }
 public static Enemy Standard(Vector2 position, Vector2 speed, VectorUpdate positionUpdate)
 {
     Enemy e = new Enemy(new Animation(StandardTexture, 1F, true, StandardTexture.Width), position, speed, Destruction, positionUpdate, (sender) => sender.IsAlive ? sender.Speed : Vector2.Zero);
     return e;
 }