示例#1
0
        public EllipsoidSurfaceNormals()
        {
            _globeShape = new Ellipsoid(1, 1, _semiMinorAxis);

            _window                   = Device.CreateWindow(800, 600, "Chapter 2:  Ellipsoid Surface Normals");
            _window.Resize           += OnResize;
            _window.RenderFrame      += OnRenderFrame;
            _window.Keyboard.KeyDown += OnKeyDown;
            _sceneState               = new SceneState();
            _camera                   = new CameraLookAtPoint(_sceneState.Camera, _window, _globeShape);

            _instructions         = new HeadsUpDisplay();
            _instructions.Texture = Device.CreateTexture2D(
                Device.CreateBitmapFromText("Up - Increase semi-minor axis\nDown - Decrease semi-minor axis",
                                            new Font("Arial", 24)),
                TextureFormat.RedGreenBlueAlpha8, false);
            _instructions.Color = Color.Black;

            _clearState = new ClearState();

            CreateScene();

            ///////////////////////////////////////////////////////////////////

            _sceneState.Camera.Eye = Vector3D.UnitY;
            _sceneState.Camera.ZoomToTarget(2 * _globeShape.MaximumRadius);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SticKart"/> class.
 /// </summary>
 public SticKart()
 {
     this.notificationManager                = null;
     this.gameState                          = GameState.InMenu;
     this.TargetElapsedTime                  = TimeSpan.FromSeconds(SticKart.FrameTime);
     this.screenDimensions                   = new Vector2(1360.0f, 768.0f);
     this.graphics                           = new GraphicsDeviceManager(this);
     this.graphics.SupportedOrientations     = DisplayOrientation.LandscapeLeft;
     this.graphics.PreferredBackBufferWidth  = (int)this.screenDimensions.X;
     this.graphics.PreferredBackBufferHeight = (int)this.screenDimensions.Y;
     Camera2D.Initialize(this.screenDimensions);
     this.headsUpDisplay                    = new HeadsUpDisplay(this.screenDimensions);
     this.Content.RootDirectory             = "Content";
     this.inputManager                      = new InputManager(this.screenDimensions, ControlDevice.Kinect, SticKart.DisplayColourStream);
     this.levelManager                      = new LevelManager(this.screenDimensions, SticKart.FrameTime);
     this.levelEditor                       = new Editor(this.screenDimensions);
     this.menuManager                       = new MenuManager(this.screenDimensions);
     this.menuManager.OnBeginLevelDetected += this.BeginLevel;
     this.menuManager.OnQuitGameDetected   += this.QuitGame;
     this.menuManager.OnEditLevelSelected  += this.EditLevel;
     this.menuManager.OnEditorSaveSelected += this.SaveCustomLevel;
     this.menuManager.OnEditorUndoSelected += this.EditorUndo;
     this.menuManager.OnEditorTypeSelected += this.EditorChangeType;
     this.menuManager.OnResumeGameDetected += this.UnpauseGame;
     this.handSprite            = new Sprite();
     this.graphics.IsFullScreen = true; // TODO: set to true for release
 }
示例#3
0
    // Use this for initialization
    void Start()
    {
        Selector = GameObject.Find("Selector").GetComponent <UnitSelector>();
        Level    = GameObject.Find("Level").GetComponent <Level>();
        HUD      = GameObject.Find("GUI").GetComponent <HeadsUpDisplay>();
        Camera   = GameObject.Find("Main Camera").GetComponent <Camera>();

        Units     = GameObject.Find("Units").transform;
        Buildings = GameObject.Find("Buildings").transform;

        Teams[0].TeamNo = 1;
        Teams[1].TeamNo = 2;

        if (saver.wasCalled)
        {
            Level.ForceStart(); // I hate this line. - ZL
            foreach (Unit u in Units.GetComponentsInChildren <Unit>())
            {
                u.ForceStart();
            }
            saver.loadGameValues();
            Day                = saver.getDay();
            CurrentTeam        = saver.getCurrentTeam();
            Teams[0].Resources = saver.getTeam1Res();
            Teams[1].Resources = saver.getTeam2Res();
        }

        Teams[0].ResetUnits();
        Teams[1].ResetUnits();
    }
示例#4
0
        void InitializeGame()
        {
            graphics.PreferredBackBufferWidth  = 1000;
            graphics.PreferredBackBufferHeight = 700;
            graphics.ApplyChanges();

            gameState = GameState.Playing;

            score = new ScoreManager();
            this.Services.AddService(typeof(IScoreManager), score);

            console = new GameConsole(this);
            this.Components.Add(console);

            pool = new PoolManager(this);
            this.Components.Add(pool);

            pm = new PickUpManager(this);
            this.Components.Add(pm);

            player = new PlayerWGun(this);
            this.Components.Add(player);

            em = new EnemyManager(this, player);
            this.Components.Add(em);

            sm = new ShotManager(this);
            this.Components.Add(sm);

            hud = new HeadsUpDisplay(this, player);
            this.Components.Add(hud);
        }
示例#5
0
        public override void SetupLevel()
        {
            Program.Level = 1;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            Stack <Action> deck = new Stack <Action>();

            deck.Push(() =>
            {
                Program.Referee.AddRule(Rule.Rules["Goal victory"]);
                Program.Engine.AddEntity(DialogBox.Create("Oh, look! I can win by touching the goal."));
            });
            deck.Push(() =>
            {
                Program.Referee.AddRule(Rule.Rules["control Player"]);
                Program.Engine.AddEntity(DialogBox.Create("Aha! I can move now! But what to do?"));
            });
            deck.Push(() => Program.Engine.AddEntity(DialogBox.Create("What is this? I can't move...")));
            deck.Push(() => Program.Referee.AddRule(Rule.Rules["top-down"]));


            SinWaveSound sound = new SinWaveSound(true,
                                                  100, 44100 / Program.TPS * 10,
                                                  0, 44100 / Program.TPS * 90);

            sound.SetWaveFormat(44100, 2);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    return;
                }

                if (Program.Referee.IsStarted && deck.Any() && timer++ % (Program.TPS * 2.5) == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(deckFlipper);

            Program.Engine.AddEntity(Player.Create(64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(Goal.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.ClearRules();

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }
示例#6
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         HUD = other.gameObject.GetComponent <HeadsUpDisplay>();
         HUD.SetTutorial(tutorialText);
     }
 }
示例#7
0
 public HeaderInfo(Game1 game, HeadsUpDisplay hud)
 {
     this.game     = game;
     this.hud      = hud;
     Position      = new Vector2(0, hud.Size.Y / 2f - 95);
     background    = HUDSpriteFactory.Instance.CreateHeaderBackground();
     compassMarker = HUDSpriteFactory.Instance.CreateCompassMarker();
 }
示例#8
0
 // Start is called before the first frame update
 void Start()
 {
     PS          = GetComponent <PlayerState>();
     PC          = GetComponent <PlayerController>();
     HUD         = GetComponent <HeadsUpDisplay>();
     isRecording = false;
     duration    = minDuration;
 }
示例#9
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player") && !initialPrompt)
     {
         HUD = other.gameObject.GetComponent <HeadsUpDisplay>();
         HUD.SetTutorial("use left joystick to move");
         initialPrompt = true;
     }
 }
示例#10
0
 public Draw(Canvas canvas, FoxDraw foxDraw, Enemies enemies, HeadsUpDisplay hud, Player player)
 {
     this.canvas         = canvas;
     this.foxDraw        = foxDraw;
     this.enemies        = enemies;
     this.headsUpDisplay = hud;
     this.player         = player;
     tileSize            = canvas.Width / 10;
 }
示例#11
0
 // Use this for initialization
 void Start()
 {
     hud = GetComponent <HeadsUpDisplay>();
     //if tasks are preloaded, set last task added as the current task
     if (tasks.Count != 0)
     {
         currTask = tasks[tasks.Count - 1];
     }
 }
 public InventoryInfo(Game1 game, HeadsUpDisplay hud)
 {
     this.game     = game;
     this.hud      = hud;
     Position      = new Vector2(0, -50);
     background    = HUDSpriteFactory.Instance.CreateInventoryBackground();
     compassMarker = HUDSpriteFactory.Instance.CreateCompassMarker();
     selector      = HUDSpriteFactory.Instance.CreateSelector();
 }
示例#13
0
 public Player(HeadsUpDisplay hud, Enemies enemies, Canvas canvas, int level = 1, bool isDead = false) : base("Hero", canvas, Images.heroDown, 0, 0, 20 + Dice.HealthRoll(), 20 + Dice.HealthRoll(), 5 + Dice.AttackPowerRoll(), 2 + Dice.DefensePowerRoll())
 {
     this.enemies   = enemies;
     this.canvas    = canvas;
     this.level     = level;
     this.isDead    = isDead;
     headsUpDisplay = hud;
     isInBattle     = false;
     spaceIsPressed = false;
 }
示例#14
0
    private void Awake()
    {
        ph  = GetComponent <PlayerHealth>();
        pc  = GetComponent <PlayerController>();
        wh  = GetComponent <WeaponHandler>();
        a   = GetComponent <AmmunitionInventory>();
        hud = GetComponent <HeadsUpDisplay>();
        gsh = GetComponent <GameStateHandler>();

        playerAudio = GetComponent <AudioSource>();
    }
示例#15
0
        public DepthBufferPrecision()
        {
            _globeShape          = Ellipsoid.Wgs84;
            _nearDistance        = 1;
            _cubeRootFarDistance = 300;

            _window                       = Device.CreateWindow(800, 600, "Chapter 6:  Depth Buffer Precision");
            _window.Resize               += OnResize;
            _window.RenderFrame          += OnRenderFrame;
            _window.Keyboard.KeyUp       += OnKeyUp;
            _window.Keyboard.KeyDown     += OnKeyDown;
            _sceneState                   = new SceneState();
            _sceneState.DiffuseIntensity  = 0.45f;
            _sceneState.SpecularIntensity = 0.05f;
            _sceneState.AmbientIntensity  = 0.5f;

            _camera = new CameraLookAtPoint(_sceneState.Camera, _window, _globeShape);

            _sceneState.Camera.ZoomToTarget(_globeShape.MaximumRadius);

            ///////////////////////////////////////////////////////////////////

            _globe       = new TessellatedGlobe();
            _globe.Shape = _globeShape;
            _globe.NumberOfSlicePartitions = 64;
            _globe.NumberOfStackPartitions = 32;
            _globe.Texture  = Device.CreateTexture2D(new Bitmap("world_topo_bathy_200411_3x5400x2700.jpg"), TextureFormat.RedGreenBlue8, false);
            _globe.Textured = true;

            _plane               = new Plane(_window.Context);
            _plane.XAxis         = 0.6 * _globeShape.MaximumRadius * Vector3D.UnitX;
            _plane.YAxis         = 0.6 * _globeShape.MinimumRadius * Vector3D.UnitZ;
            _plane.OutlineWidth  = 3;
            _cubeRootPlaneHeight = 100.0;
            UpdatePlaneOrigin();

            _viewportQuad = new ViewportQuad(_window.Context, null);

            _framebuffer              = _window.Context.CreateFramebuffer();
            _depthFormatIndex         = 1;
            _depthTestLess            = true;
            _logarithmicDepthConstant = 1;
            UpdatePlanesAndDepthTests();

            _clearState = new ClearState();

            ///////////////////////////////////////////////////////////////////

            _hudFont   = new Font("Arial", 16);
            _hud       = new HeadsUpDisplay();
            _hud.Color = Color.Blue;
            UpdateHUD();
        }
示例#16
0
    // Use this for initialization
    void Start()
    {
        Selector = GameObject.Find("Selector").GetComponent <UnitSelector>();
        Level    = GameObject.Find("Level").GetComponent <Level>();
        HUD      = GameObject.Find("GUI").GetComponent <HeadsUpDisplay>();
        Camera   = GameObject.Find("Main Camera").GetComponent <Camera>();

        Units     = GameObject.Find("Units").transform;
        Buildings = GameObject.Find("Buildings").transform;

        Teams[0].TeamNo = 1;
        Teams[1].TeamNo = 2;
    }
 // Use this for initialization
 void Awake()
 {
     im             = InputManager.Instance;
     cam_controller = GetComponentInChildren <CameraController>();
     if (gameObject.GetComponent <HeadsUpDisplay>() == null)
     {
         hud = gameObject.AddComponent <HeadsUpDisplay>();
     }
     if (gameObject.GetComponent <StartMenu>() == null)
     {
         start_menu = gameObject.AddComponent <StartMenu>();
     }
 }
示例#18
0
    //public Mask mask;

    //dentro coroutine (ienumerator)

    /*while(true)
     *
     * if( user list = null)
     *  is null , no instantiation
     * else
     *  instantiate hud piece per player
     *
     * */
    void Awake()
    {
        HUDInfos = new HeadsUpDisplay[4];
        for (int i = 0; i < 4; i++)
        {
            HUDInfos[i] = ScriptableObject.CreateInstance <HeadsUpDisplay>();
            // hardcoding default values
            HeadsUpDisplay.LoadFromHUDData(DefHUDInfo, HUDInfos[i]);
            HUDInfos[i].name = string.Format("Player {0} HUD data", i);
        }

        StartCoroutine(InitClientHUD());
    }
        public ClipmapTerrainOnGlobe()
        {
            _window = Device.CreateWindow(800, 600, "Chapter 13:  Clipmap Terrain on a Globe");

            _ellipsoid = Ellipsoid.Wgs84;

            WorldWindTerrainSource terrainSource = new WorldWindTerrainSource();
            EsriRestImagery        imagery       = new EsriRestImagery();

            _clipmap = new GlobeClipmapTerrain(_window.Context, terrainSource, imagery, _ellipsoid, 511);
            _clipmap.HeightExaggeration = 1.0f;

            _sceneState = new SceneState();
            _sceneState.DiffuseIntensity    = 0.90f;
            _sceneState.SpecularIntensity   = 0.05f;
            _sceneState.AmbientIntensity    = 0.05f;
            _sceneState.Camera.FieldOfViewY = Math.PI / 3.0;

            _clearState       = new ClearState();
            _clearState.Color = Color.White;

            _sceneState.Camera.PerspectiveNearPlaneDistance = 0.000001 * _ellipsoid.MaximumRadius;
            _sceneState.Camera.PerspectiveFarPlaneDistance  = 10.0 * _ellipsoid.MaximumRadius;
            _sceneState.SunPosition = new Vector3D(200000, 300000, 200000) * _ellipsoid.MaximumRadius;

            _lookCamera       = new CameraLookAtPoint(_sceneState.Camera, _window, _ellipsoid);
            _lookCamera.Range = 1.5 * _ellipsoid.MaximumRadius;

            _globe       = new RayCastedGlobe(_window.Context);
            _globe.Shape = _ellipsoid;
            Bitmap bitmap = new Bitmap("NE2_50M_SR_W_4096.jpg");

            _globe.Texture = Device.CreateTexture2D(bitmap, TextureFormat.RedGreenBlue8, false);

            _clearDepth         = new ClearState();
            _clearDepth.Buffers = ClearBuffers.DepthBuffer | ClearBuffers.StencilBuffer;

            _window.Keyboard.KeyDown += OnKeyDown;

            _window.Resize         += OnResize;
            _window.RenderFrame    += OnRenderFrame;
            _window.PreRenderFrame += OnPreRenderFrame;

            _hudFont   = new Font("Arial", 16);
            _hud       = new HeadsUpDisplay();
            _hud.Color = Color.Blue;
            UpdateHUD();
        }
示例#20
0
        public Jitter()
        {
            _window                 = Device.CreateWindow(800, 600, "Chapter 5:  Jitter");
            _window.Resize         += OnResize;
            _window.RenderFrame    += OnRenderFrame;
            _window.Keyboard.KeyUp += OnKeyUp;
            _sceneState             = new SceneState();
            _clearState             = new ClearState();

            _hudFont   = new Font("Arial", 16);
            _hud       = new HeadsUpDisplay();
            _hud.Color = Color.Black;

            CreateCamera();
            CreateAlgorithm();
        }
示例#21
0
        public TerrainShading()
        {
            _window                   = Device.CreateWindow(800, 600, "Chapter 11:  Terrain Shading");
            _window.Resize           += OnResize;
            _window.RenderFrame      += OnRenderFrame;
            _window.Keyboard.KeyDown += OnKeyDown;
            _window.Keyboard.KeyUp   += OnKeyUp;
            _sceneState               = new SceneState();
            _sceneState.Camera.PerspectiveFarPlaneDistance = 4096;
            _sceneState.DiffuseIntensity  = 0.9f;
            _sceneState.SpecularIntensity = 0.05f;
            _sceneState.AmbientIntensity  = 0.05f;
            _clearState = new ClearState();

            ///////////////////////////////////////////////////////////////////

            TerrainTile terrainTile = TerrainTile.FromBitmap(new Bitmap("ps-e.lg.png"));

            _tile = new VertexDisplacementMapTerrainTile(_window.Context, terrainTile);
            _tile.HeightExaggeration     = 30;
            _tile.ColorMapTexture        = Device.CreateTexture2D(new Bitmap("ps_texture_1k.png"), TextureFormat.RedGreenBlue8, false);
            _tile.ColorRampHeightTexture = Device.CreateTexture2D(new Bitmap("ColorRamp.jpg"), TextureFormat.RedGreenBlue8, false);
            _tile.ColorRampSlopeTexture  = Device.CreateTexture2D(new Bitmap("ColorRampSlope.jpg"), TextureFormat.RedGreenBlue8, false);
            _tile.BlendRampTexture       = Device.CreateTexture2D(new Bitmap("BlendRamp.jpg"), TextureFormat.Red8, false);
            _tile.GrassTexture           = Device.CreateTexture2D(new Bitmap("Grass.jpg"), TextureFormat.RedGreenBlue8, false);
            _tile.StoneTexture           = Device.CreateTexture2D(new Bitmap("Stone.jpg"), TextureFormat.RedGreenBlue8, false);
            _tile.BlendMaskTexture       = Device.CreateTexture2D(new Bitmap("BlendMask.jpg"), TextureFormat.Red8, false);

            ///////////////////////////////////////////////////////////////////

            double tileRadius = Math.Max(terrainTile.Resolution.X, terrainTile.Resolution.Y) * 0.5;

            _camera                           = new CameraLookAtPoint(_sceneState.Camera, _window, Ellipsoid.UnitSphere);
            _camera.CenterPoint               = new Vector3D(terrainTile.Resolution.X * 0.5, terrainTile.Resolution.Y * 0.5, 0.0);
            _camera.MinimumRotateRate         = 1.0;
            _camera.MaximumRotateRate         = 1.0;
            _camera.RotateRateRangeAdjustment = 0.0;
            _camera.RotateFactor              = 0.0;
            _sceneState.Camera.ZoomToTarget(tileRadius);

            ///////////////////////////////////////////////////////////////////

            _hudFont   = new Font("Arial", 16);
            _hud       = new HeadsUpDisplay();
            _hud.Color = Color.Black;
            UpdateHUD();
        }
示例#22
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         //TODO: Prompt player that they can modify the ghost in seed
         PS  = other.GetComponent <PlayerState>();
         HUD = other.GetComponent <HeadsUpDisplay>();
         GM  = other.GetComponent <GhostManager>();
         if (!GM.isRecording)
         {
             Debug.Log("Seed::Player touching seed");
             HUD.PushPrompt(PromptText);
             PS.onInteractEnd += OnInteract;
             PS.onSeed         = true;
         }
     }
 }
示例#23
0
        public Curves()
        {
            _semiMinorAxis = Ellipsoid.ScaledWgs84.Radii.Z;
            SetShape();

            _window                   = Device.CreateWindow(800, 600, "Chapter 2:  Curves");
            _window.Resize           += OnResize;
            _window.RenderFrame      += OnRenderFrame;
            _window.Keyboard.KeyDown += OnKeyDown;
            _sceneState               = new SceneState();
            _camera                   = new CameraLookAtPoint(_sceneState.Camera, _window, _globeShape);

            _clearState = new ClearState();

            _texture = Device.CreateTexture2D(new Texture2DDescription(1, 1, TextureFormat.RedGreenBlue8));
            WritePixelBuffer pixelBuffer = Device.CreateWritePixelBuffer(PixelBufferHint.Stream, 3);

            pixelBuffer.CopyFromSystemMemory(new byte[] { 0, 255, 127 });
            _texture.CopyFromBuffer(pixelBuffer, ImageFormat.RedGreenBlue, ImageDatatype.UnsignedByte, 1);

            _instructions       = new HeadsUpDisplay();
            _instructions.Color = Color.Black;

            _sampledPoints                  = new BillboardCollection(_window.Context);
            _sampledPoints.Texture          = Device.CreateTexture2D(Device.CreateBitmapFromPoint(8), TextureFormat.RedGreenBlueAlpha8, false);
            _sampledPoints.DepthTestEnabled = false;

            _ellipsoid         = new RayCastedGlobe(_window.Context);
            _ellipsoid.Texture = _texture;

            _polyline                  = new Polyline();
            _polyline.Width            = 3;
            _polyline.DepthTestEnabled = false;

            _plane              = new Plane(_window.Context);
            _plane.Origin       = Vector3D.Zero;
            _plane.OutlineWidth = 3;

            CreateScene();

            ///////////////////////////////////////////////////////////////////

            _sceneState.Camera.Eye = Vector3D.UnitY;
            _sceneState.Camera.ZoomToTarget(2 * _globeShape.MaximumRadius);
        }
示例#24
0
文件: Game.cs 项目: burtybob/OpenAW3D
    // Use this for initialization
    void Start()
    {
        Selector = GameObject.Find("Selector").GetComponent <UnitSelector>();
        Level    = GameObject.Find("Level").GetComponent <Level>();
        HUD      = GameObject.Find("GUI").GetComponent <HeadsUpDisplay>();
        Camera   = GameObject.Find("Main Camera").GetComponent <Camera>();

        Units     = GameObject.Find("Units").transform;
        Buildings = GameObject.Find("Buildings").transform;

        AudioClip ac = Resources.Load <AudioClip>("Audio/Music/01 Jake's Theme");

        Camera.GetComponent <AudioSource>().clip = ac;
        Camera.GetComponent <AudioSource>().Play();

        Teams[0].TeamNo = 1;
        Teams[1].TeamNo = 2;
    }
示例#25
0
        public PlayState(DemoGame game, string LevelFile) : base(game)
        {
            spriteBatch     = game.Services.GetService <SpriteBatch>();
            camera          = game.Services.GetService <FocusCamera>();
            settings        = game.Services.GetService <GameSettings>();
            scriptingEngine = game.Services.GetService <ScriptingEngine>();
            context         = game.Services.GetService <GameContext>();
            monitor         = new FpsMonitor();

            lvlFile = LevelFile;
            //var dir = Path.Combine(DemoGame.ContentManager.RootDirectory,"Scripts");
            //var files = Directory.GetFiles(dir);
            //scriptingEngine.LoadScript(files);

            hud = new HeadsUpDisplay();


            LoadContent(game.ContentManager);
            Initialize();
        }
示例#26
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     GoombaSpriteFactory.Instance.LoadAllTextures(Content);
     BowserSpriteFactory.Instance.LoadAllTextures(Content);
     KoopaSpriteFactory.Instance.LoadAllTextures(Content);
     ItemSpriteFactory.Instance.LoadAllTextures(Content);
     BlockSpriteFactory.Instance.LoadAllTextures(Content);
     WorldElementSpriteFactory.Instance.LoadAllTextures(Content);
     MarioSpriteFactory.Instance.LoadAllTextures(Content);
     FireballSpriteFactory.Instance.LoadAllTextures(Content);
     AchievementSpriteFactory.Instance.LoadAllTextures(Content);
     LakituSpriteFactory.Instance.LoadAllTextures(Content);
     SoundEffects.Instance.LoadSoundEffects(Content);
     Songs.Instance.LoadSongs(Content);
     HUD = new HeadsUpDisplay(this, Content);
     WorldLoader.LoadWorld("Level1-1", this);
     Songs.Instance.PlaySong();
     Tester.RunTests(this);
 }
示例#27
0
 private void OnTriggerEnter(Collider collider)
 {
     if (collider.CompareTag("Player"))
     {
         Debug.Log("Dirt::Player stepped on dirt");
         PS                 = collider.gameObject.GetComponent <PlayerState>();
         GM                 = collider.gameObject.GetComponent <GhostManager>();
         HUD                = collider.gameObject.GetComponent <HeadsUpDisplay>();
         PS.onDirt          = true;
         PS.onInteractEnd  += PlantSeed;
         PS.onInteractHold += ResetDirt;
         if (!GM.isRecording)
         {
             HUD.PushPrompt(PromptText);
             PS.currDirt = this;
             GM.duration = _ghostDuration;
         }
         isTracking = true;
         Text.gameObject.SetActive(true);
     }
 }
示例#28
0
        public TerrainRayCasting()
        {
            _window                   = Device.CreateWindow(800, 600, "Chapter 11:  Terrain Ray Casting");
            _window.Resize           += OnResize;
            _window.RenderFrame      += OnRenderFrame;
            _window.Keyboard.KeyDown += OnKeyDown;
            _sceneState               = new SceneState();
            _sceneState.Camera.PerspectiveFarPlaneDistance = 4096;
            _clearState = new ClearState();

            ///////////////////////////////////////////////////////////////////

            // 创建地形高程对象
            TerrainTile terrainTile = TerrainTile.FromBitmap(new Bitmap(@"ps-e.lg.png"));

            // 创建地形图形可渲染对象
            _tile = new RayCastedTerrainTile(terrainTile);
            // 地形高度缩放因子(可以使高山更高)
            _tile.HeightExaggeration = 30;

            ///////////////////////////////////////////////////////////////////

            // 根据地形设置相机位置
            double tileRadius = Math.Max(terrainTile.Resolution.X, terrainTile.Resolution.Y) * 0.5;

            _camera                           = new CameraLookAtPoint(_sceneState.Camera, _window, Ellipsoid.UnitSphere);
            _camera.CenterPoint               = new Vector3D(terrainTile.Resolution.X * 0.5, terrainTile.Resolution.Y * 0.5, 0.0);
            _camera.MinimumRotateRate         = 1.0;
            _camera.MaximumRotateRate         = 1.0;
            _camera.RotateRateRangeAdjustment = 0.0;
            _camera.RotateFactor              = 0.0;
            _sceneState.Camera.ZoomToTarget(tileRadius);

            ///////////////////////////////////////////////////////////////////

            _hudFont   = new Font("Arial", 16);
            _hud       = new HeadsUpDisplay();
            _hud.Color = Color.Black;
            UpdateHUD();
        }
示例#29
0
    private void Awake()
    {
        inSightType          = InSightType.None;
        isFadeCrosshair      = false;
        current              = this;
        HitCrosshair.enabled = false;

        _crosshairFadeCooldown = new Cooldown {
            OnUpdate = CrosshairFadeUpdate, OnFinish = CrosshairFadeFinish
        };
        _ammunitionFadeCooldown = new Cooldown {
            OnUpdate = AmmunitionFadeUpdate
        };
        _killCountFadeCooldown = new Cooldown {
            OnUpdate = KillCountFadeUpdate
        };

        insightCrosshairColours = new Dictionary <InSightType, Color>
        {
            { InSightType.None, Color.white },
            { InSightType.Friendly, FriendlyCrosshair },
            { InSightType.Enemy, EnemyCrosshair }
        };

        AmmunitionContainer.alpha = 0f;
        KillCountContainer.alpha  = 0f;

        var hudFont = Resources.Load <Font>("Fonts/EU____");

        ammoStyle = new GUIStyle
        {
            alignment = TextAnchor.MiddleRight,
            normal    = { textColor = Color.white },
            font      = hudFont,
            fontSize  = 30
        };
    }
        public MainWindow()
        {
            InitializeComponent();
            FoxDraw foxDraw = new FoxDraw(canvas);

            gameSetup      = new GameSetup(canvas, 500);
            enemies        = new Enemies();
            headsUpDisplay = new HeadsUpDisplay(canvas);
            player         = new Player(headsUpDisplay, enemies, canvas);
            graphics       = new Draw(canvas, foxDraw, enemies, headsUpDisplay, player);

            Characters.AddToList(player);

            enemies.Add(new Enemy("Boss", player, canvas, Images.boss, 9, 9, true, 20, 20, 10));
            enemies.Add(new Enemy("SkeletonA", player, canvas, Images.skeleton, 0, 5));
            enemies.Add(new Enemy("SkeletonB", player, canvas, Images.skeleton, 4, 3));
            enemies.Add(new Enemy("SkeletonC", player, canvas, Images.skeleton, 7, 8));

            animator = new Animator(player, graphics);

            graphics.Refresh();
            Sound.PlayMusic(Sounds.mapMusic);
            animator.SpriteAnimation();
        }
示例#31
0
 private void Awake()
 {
     Cursor.visible = false;
     var font = Resources.Load<Font>("Font/Eurostile");
     killCountStyle = new GUIStyle { fontSize = 20, normal = { textColor = Color.white }, alignment = TextAnchor.MiddleLeft, font = font };
     moneyStyle = new GUIStyle { fontSize = 20, normal = { textColor = Color.white }, alignment = TextAnchor.MiddleRight, font = font };
     healthStyle = moneyStyle;
     current = this;
     isShown = true;
     HurtOverlay.color = new Color(1f, 1f, 1f, 0f);
 }
示例#32
0
    void Start()
    {
        mAnimator = GetComponent<Animator>();
        mAudioSource = GetComponent<AudioSource>();
        this.embarrassmentMeter = GameObject.Find("EmbarassmentMeter").GetComponent<EmbarrassmentMeter>();
        playerStats = GameObject.Find("PlayerStats").GetComponent<PlayerStats>();
        this.cooldownTimer = this.allowCooldownTime;

        this.enemyList = GameObject.FindGameObjectsWithTag("Enemy");
        this.enemyScript = this.enemyList[0].GetComponent<BaseEnemy>();
        AlarmSound = (AudioSource)GameObject.Find("AlarmSound").GetComponent<AudioSource>();

        this.playerReskinScript = this.GetComponent<PlayerReskin>();

        ewwManager = GameObject.Find ("EwwManager").GetComponent<EwwManager>();

        this.headsUpDisplayScript = GameObject.Find("HeadsUpDisplay").GetComponent<HeadsUpDisplay>();

        //this.actionButtonE = GameObject.Find("ActionButtonE");
    }
示例#33
0
    private void Awake()
    {
        inSightType = InSightType.None;
        isFadeCrosshair = false;
        current = this;
        HitCrosshair.enabled = false;

        var hudFont = Resources.Load<Font>("Fonts/EU____");
        ammoStyle = new GUIStyle
        {
            alignment = TextAnchor.MiddleRight,
            normal = { textColor = Color.white },
            font = hudFont,
            fontSize = 30
        };
    }
示例#34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SticKart"/> class.
 /// </summary>
 public SticKart()
 {
     this.notificationManager = null;
     this.gameState = GameState.InMenu;
     this.TargetElapsedTime = TimeSpan.FromSeconds(SticKart.FrameTime);
     this.screenDimensions = new Vector2(1360.0f, 768.0f);
     this.graphics = new GraphicsDeviceManager(this);
     this.graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;
     this.graphics.PreferredBackBufferWidth = (int)this.screenDimensions.X;
     this.graphics.PreferredBackBufferHeight = (int)this.screenDimensions.Y;
     Camera2D.Initialize(this.screenDimensions);
     this.headsUpDisplay = new HeadsUpDisplay(this.screenDimensions);
     this.Content.RootDirectory = "Content";
     this.inputManager = new InputManager(this.screenDimensions, ControlDevice.Kinect, SticKart.DisplayColourStream);
     this.levelManager = new LevelManager(this.screenDimensions, SticKart.FrameTime);
     this.levelEditor = new Editor(this.screenDimensions);
     this.menuManager = new MenuManager(this.screenDimensions);
     this.menuManager.OnBeginLevelDetected += this.BeginLevel;
     this.menuManager.OnQuitGameDetected += this.QuitGame;
     this.menuManager.OnEditLevelSelected += this.EditLevel;
     this.menuManager.OnEditorSaveSelected += this.SaveCustomLevel;
     this.menuManager.OnEditorUndoSelected += this.EditorUndo;
     this.menuManager.OnEditorTypeSelected += this.EditorChangeType;
     this.menuManager.OnResumeGameDetected += this.UnpauseGame;
     this.handSprite = new Sprite();
     this.graphics.IsFullScreen = true; // TODO: set to true for release
 }
示例#35
0
    private void Awake()
    {
        _current = this;
        HitImage.color = new Color(1, 1, 1, 0);
        _squadronIcons = new List<SquadronIcon>();
        _crosshairImage = Crosshair.GetComponent<Image>();

        _healthOpacity = HealthBar.color.a;
        _shieldOpacity = ShieldBar.color.a;
        _boostOpacity = BoostBar.color.a;

        MessageText.enabled = false;
    }
示例#36
0
    // Use this for initialization
    void Start()
    {
        Selector = GameObject.Find("Selector").GetComponent<UnitSelector>();
        Level = GameObject.Find("Level").GetComponent<Level>();
        HUD = GameObject.Find("GUI").GetComponent<HeadsUpDisplay>();
        Camera = GameObject.Find("Main Camera").GetComponent<Camera>();

        Units = GameObject.Find("Units").transform;
        Buildings = GameObject.Find("Buildings").transform;

        Teams[0].TeamNo = 1;
        Teams[1].TeamNo = 2;
    }