Exemplo n.º 1
0
 public PlayerUnit(Game1 game,Vector3 Position, Vector3 Rotation, Vector3 Scale)
     : base(game,Position, Rotation, Scale)
 {
     game.mediator.register(this, MyEvent.C_FORWARD, MyEvent.C_BACKWARD, MyEvent.C_LEFT,
         MyEvent.C_RIGHT, MyEvent.C_Pointer, MyEvent.M_BITE);
     health = 100;
 }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Exemplo n.º 3
0
 public Weapon(Game1 game,Player player, Model model, Unit unit)
     : base(game, unit, new CModel(game, model))
 {
     this.player = player;
     Matrix[] transforms = new Matrix[model.Bones.Count];
     model.CopyAbsoluteBoneTransformsTo(transforms);
 }
Exemplo n.º 4
0
 public SkyModel(Game1 game, Model model, TextureCube Texture)
     : base(game,model)
 {
     effect = game.Content.Load<Effect>("skysphere_effect");
     effect.Parameters["CubeMap"].SetValue(Texture);
     SetModelEffect(effect, false);
 }
Exemplo n.º 5
0
 public LevelBuilder(Game1 currentGame)
 {
     level=new Entity[64];
     cursorPos=new Vector2((mouseState.X/32)*32,(mouseState.Y/32)*32);
     pressed=false;
     this.currentGame=currentGame;
 }
 public PlayerModel(Game1 game, SkinnedModel skinnedModel)
     : base(game, skinnedModel)
 {
     game.mediator.register(this, MyEvent.P_RUN, MyEvent.C_ATTACK_BULLET_BEGIN);
     animationController.Speed = 1.2f;
     activeAnimation = PlayerAnimations.Idle;
     playAnimation();
 }
Exemplo n.º 7
0
        public HelpScreen(Game1 game)
            : base(game)
        {
            myGame = game;

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            delayedAction = new DelayedAction();
        }
        public FirstAidManager(Game1 game)
            : base(game)
        {
            firstAidKits = new List<FirstAid>();
            myGame = game;

            rnd = new Random();
        }
Exemplo n.º 9
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         //cannot access disposed object
         game.Run();
     }
 }
 public CDrawableComponent(Game1 game,Unit unit, CModel model)
     : base(game)
 {
     myGame = game;
     this.unit = unit;
     this.cModel = model;
     unit.BoundingSphere = cModel.buildBoundingSphere();
 }
Exemplo n.º 11
0
        // Pause variables
        //int pauseDelay = 300;
        //int pauseCountdown = 0;
        public StateManager(Game1 game)
            : base(game)
        {
            myGame = game;

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            delayedAction = new DelayedAction();
        }
Exemplo n.º 12
0
        public StartScreen(Game1 game)
            : base(game)
        {
            myGame = game;

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            emptyTex = game.Content.Load<Texture2D>("empty2");
            delayedAction = new DelayedAction(100);
        }
Exemplo n.º 13
0
        public ScoreBoard(Game1 game)
            : base(game)
        {
            this.camera = game.camera;
            myGame = game;
            game.mediator.register(this, MyEvent.M_DIE);
            events = new List<Event>();

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
        }
Exemplo n.º 14
0
        public Monster(Game1 game, SkinnedModel skinnedModel, Unit unit)
            : base(game, unit, new MonsterModel(game, skinnedModel))
        {
            monsterModel = ((MonsterModel)cModel);
            monsterUnit = ((MonsterUnit)unit);

            foreach (ModelMesh mesh in skinnedModel.Model.Meshes)
                foreach (SkinnedEffect effect in mesh.Effects)
                    effect.EnableDefaultLighting();
        }
Exemplo n.º 15
0
        public FreeCamera(Game1 game, Vector3 Position, float Yaw, float Pitch,
            float minHeight, float maxHeight)
            : base(game)
        {
            this.Position = Position;
            this.Yaw = Yaw;
            this.Pitch = Pitch;
            this.minHeight = minHeight;
            this.maxHeight = maxHeight;

            translation = Vector3.Zero;
        }
Exemplo n.º 16
0
 public ChaseCamera(Game1 game, Vector3 PositionOffset, Vector3 TargetOffset,
     Vector3 RelativeCameraRotation )
     : base(game)
 {
     this.savedTargetOffset = TargetOffset;
     this.savedPositionOffset = PositionOffset;
     this.PositionOffset = PositionOffset;
     this.TargetOffset = TargetOffset;
     this.RelativeCameraRotation = RelativeCameraRotation;
     Mouse.SetPosition(myGame.GraphicsDevice.Viewport.Width / 2, myGame.GraphicsDevice.Viewport.Height / 2);
     lastMouseState = Mouse.GetState();
 }
Exemplo n.º 17
0
        public Unit(Game1 game,Vector3 position,Vector3 rotation,Vector3 scale)
        {
            baseWorld = Matrix.Identity;

            this.position = position;
            this.rotation = rotation;
            this.scale = scale;

            this.myGame = game;

            this.events = new List<Event>();
        }
Exemplo n.º 18
0
        public Player(Game1 game, SkinnedModel skinnedModel, Unit unit)
            : base(game, unit, new PlayerModel(game, skinnedModel))
        {
            foreach (ModelMesh mesh in skinnedModel.Model.Meshes)
                foreach (SkinnedEffect effect in mesh.Effects)
                    effect.EnableDefaultLighting();

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            crossHairTex = game.Content.Load<Texture2D>("crosshair");
            delayedAction = new DelayedAction(800);
            //run at first to show to the character otherwise the character dont show
            playerRun();
        }
        public MonstersManager(Game1 game)
            : base(game)
        {
            monsters = new List<Monster>();
            myGame = game;

            rnd = new Random();

            hpBillBoardSystem = new HPBillboardSystem(game.GraphicsDevice, game.Content, Constants.HP_SIZE, monsters);
            //skinnedModel = Game.Content.Load<SkinnedModel>(@"Textures\EnemyBeast");

            skinnedModel = Game.Content.Load<SkinnedModel>(@"model\EnemyBeast");
        }
Exemplo n.º 20
0
        public CModel(Game1 game, Model Model)
        {
            this.Model = Model;

            baseWorld = Matrix.Identity;

            modelTransforms = new Matrix[Model.Bones.Count];
            Model.CopyAbsoluteBoneTransformsTo(modelTransforms);

            generateTags();

            myGame = game;

            events = new List<Event>();
        }
Exemplo n.º 21
0
        public AudioManager(Game1 game)
            : base(game)
        {
            myGame = game;
            events = new List<Event>();
            game.mediator.register(this, MyEvent.C_ATTACK_BULLET_END, MyEvent.M_BITE, MyEvent.G_GameOver);

            audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");

            trackCue =  soundBank.GetCue("Cowboy");
            trackCue.Play();
            trackCue.Pause();
        }
        public AnimatedModel(Game1 game,SkinnedModel skinnedModel)
            : base(game,skinnedModel.Model)
        {
            this.skinnedModel = skinnedModel;
            //setNewEffect();

            // Create an animation controller and start a clip
            animationController = new AnimationController(skinnedModel.SkeletonBones);
            animationController.Speed = 0.5f;

            animationController.TranslationInterpolation = InterpolationMode.Linear;
            animationController.OrientationInterpolation = InterpolationMode.Linear;
            animationController.ScaleInterpolation = InterpolationMode.Linear;

            //animationController.StartClip(skinnedModel.AnimationClips[animation]);
        }
Exemplo n.º 23
0
        public Entity(string asset,Vector2 pos,int frameWidth,int frameHeight,int offset,bool solid,bool active,Game1 game)
            : base(asset,pos,frameWidth,frameHeight,offset)
        {
            Solid=solid;
            Active=active;

            Vspeed=0;
            Hspeed=0;

            Grav=0;
            Fric=0;

            Bbox=new Hitbox(Pos,frameWidth,frameHeight,this);

            currentGame=game;
        }
Exemplo n.º 24
0
        public Entity(string asset,Vector2 pos,int frameWidth,int frameHeight,int offset,Game1 game)
            : base(asset,pos,frameWidth,frameHeight,offset)
        {
            Solid=false;
            Active=true;

            Vspeed=0;
            Hspeed=0;
            maxVspeed=(float)frameHeight*2;

            Grav=0;
            Fric=0;

            Bbox=new Hitbox(Pos,frameWidth,frameHeight,this);

            currentGame=game;
        }
Exemplo n.º 25
0
 public BulletUnit(Game1 game,Vector3 Position, Vector3 Rotation, Vector3 Scale,Vector3 Direction)
     : base(game,Position, Rotation, Scale)
 {
     this.Direction = Direction;
 }
Exemplo n.º 26
0
 public Bullet(Game1 game, Model model, Unit unit)
     : base(game, unit,new CModel(game, model))
 {
 }
Exemplo n.º 27
0
 public Camera(Game1 game)
     : base(game)
 {
     generatePerspectiveProjectionMatrix(MathHelper.PiOver4);
     myGame = game;
 }
Exemplo n.º 28
0
 //private const int updateDelay = 1000;
 //private int sinceLastUpdate = 0;
 public SkyUnit(Game1 game,Vector3 Position, Vector3 Rotation, Vector3 Scale)
     : base(game,Position, Rotation, Scale)
 {
     RotationSpeed = MathHelper.PiOver4;
 }
Exemplo n.º 29
0
 public FirstAid(Game1 game, Model model, Unit unit)
     : base(game, unit, new CModel(game,model))
 {
 }
Exemplo n.º 30
0
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }