示例#1
0
        public EnemyShip(EnemyType t, string spritesheetName = "enemy", DrawManager.Layer drawLayer = DrawManager.Layer.Playground) : base(Vector2.Zero, spritesheetName, drawLayer)
        {
            this.Type = t;

            sprite.FlipX = true;
            sprite.scale = new Vector2(0.3f, 0.3f);
            Velocity     = new Vector2(-200, 0);
            IsActive     = false;
            cannonOffset = new Vector2(-Width / 2, 0);
            RigidBody    = new RigidBody(sprite.position, this);

            float horizontalSpeed = -RandomGenerator.GetRandom(200, 350);

            RigidBody.Velocity = new Vector2(horizontalSpeed, 0);
            RigidBody.Type     = (uint)PhysicsManager.ColliderType.Enemy;
            RigidBody.AddCollisionMask((uint)PhysicsManager.ColliderType.Player);

            MaxNrg = 1;
            Nrg    = MaxNrg;
        }
示例#2
0
 public PlayerBullet(string textureName = "bullets") : base(textureName)
 {
     RigidBody.Type = (uint)PhysicsManager.ColliderType.PlayerBullet;
     RigidBody.AddCollisionMask((uint)PhysicsManager.ColliderType.Enemy);
     RigidBody.AddCollisionMask((uint)PhysicsManager.ColliderType.EnemyBullet);
 }