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;
 }
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
 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);
 }
 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);
 }
Exemple #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();
 }
        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();
        }
Exemple #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();
 }
        // Pause variables
        //int pauseDelay = 300;
        //int pauseCountdown = 0;
        public StateManager(Game1 game)
            : base(game)
        {
            myGame = game;

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

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            emptyTex = game.Content.Load<Texture2D>("empty2");
            delayedAction = new DelayedAction(100);
        }
        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);
        }
        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();
        }
        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;
        }
 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();
 }
        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>();
        }
        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");
        }
        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>();
        }
        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]);
        }
Exemple #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;
        }
Exemple #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;
        }
 public BulletUnit(Game1 game,Vector3 Position, Vector3 Rotation, Vector3 Scale,Vector3 Direction)
     : base(game,Position, Rotation, Scale)
 {
     this.Direction = Direction;
 }
 public Bullet(Game1 game, Model model, Unit unit)
     : base(game, unit,new CModel(game, model))
 {
 }
 public Camera(Game1 game)
     : base(game)
 {
     generatePerspectiveProjectionMatrix(MathHelper.PiOver4);
     myGame = game;
 }
 //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;
 }
 public FirstAid(Game1 game, Model model, Unit unit)
     : base(game, unit, new CModel(game,model))
 {
 }
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }