Ejemplo n.º 1
0
        public override void Load()
        {
            CollisionManager.Instance().WallCollideReset();

            entityManager = EntityManager.Instance();
            systemManager = SystemManager.Instance();
            inputManager  = InputManager.Instance();

            audioManager = AudioManager.Instance();
            audioManager.AddAudio("Death", "Audio/WilhelmScream.wav", false);
            audioManager.AddAudio("Collect", "Audio/CollectCoin.wav", false);
            audioManager.AddAudio("Powerup", "Audio/ElevatorMusic.wav", true);
            audioManager.AddAudio("KillGhost", "Audio/ko.wav", false);

            coinsCollected = 0;

            // Set the title of the window
            sceneManager.Title = "Game";
            // Set the Render and Update delegates to the Update and Render methods of this class
            sceneManager.renderer = Render;
            sceneManager.updater  = Update;
            // Set Keyboard events to go to a method in this class
            sceneManager.Keyboard.KeyDown += Keyboard_KeyDown;

            GL.ClearColor(0.0f, 0.0f, 0.0f, 1.0f);

            map = new MapLoader();
            map.LoadMap("Maps/Level1.txt");

            mapCamera    = new MiniMapCamera(map.GetWidth(), map.GetHeight(), sceneManager.Width, sceneManager.Height);
            entityCamera = new EntityCamera(sceneManager.Width, sceneManager.Height);

            mapCamera.Position  = new Vector3(0, 0, 0);
            mapCamera.Direction = new Vector3(0, -1, 0);
            mapCamera.Up        = new Vector3(0, 0, -1);

            CollisionManager.Instance().SetMap(map);
            CollisionManager.Instance().SetLevel(this);
            Entity player = map.GetPlayer();

            entityCamera.SetEntity(player);
            audioManager.SetCamera(entityCamera);

            CreateSystems();

            CubeMapTexture cubeMap = ResourceManager.LoadCubeMap("Textures/darkskies_up.png", "Textures/darkskies_dn.png", "Textures/darkskies_lf.png",
                                                                 "Textures/darkskies_rt.png", "Textures/darkskies_ft.png", "Textures/darkskies_bk.png");

            Shader   shader   = ResourceManager.LoadShader("Shaders/cubemapVS.glsl", "Shaders/cubemapFS.glsl");
            Geometry geometry = ResourceManager.LoadGeometry("Geometry/SkyBox.obj");

            cubemapRender = new CubeMapRender(entityCamera, cubeMap, shader, geometry);
            customRender  = new MiniMapRender(entityCamera, mapCamera);
        }
Ejemplo n.º 2
0
 // Inicialização
 void Start()
 {
     player        = GameObject.FindGameObjectWithTag("Player").transform; // Lê a posição do personagem no cenário
     rb            = GetComponent <Rigidbody2D>();                         // Inicializa a física do inimigo
     anim          = GetComponent <Animator>();                            // Inicializa o gerenciador de animação do inimigo
     sprite        = GetComponent <SpriteRenderer>();                      // Inicializa a imagem do inimigo
     startPos      = new Vector2(transform.position.x, transform.position.y);
     am            = FindObjectOfType <AudioManager>();
     audioDeath    = am.AddAudio(clipDeath, false, false, 1f);
     audioFireball = am.AddAudio(clipFireball, false, false, 1f);
     audioBuff     = am.AddAudio(clipBuff, false, false, 1f);
 }
Ejemplo n.º 3
0
 // Inicialização
 void Start()
 {
     sprite      = GetComponent <SpriteRenderer>();   // Atribui à porta sua imagem
     boxCollider = GetComponent <BoxCollider2D>();    // Ativa a caixa de colisão da porta
     am          = FindObjectOfType <AudioManager>();
     audioOpen   = am.AddAudio(clipOpen, false, false, 1f);
 }
Ejemplo n.º 4
0
 // Inicialização
 void Start()
 {
     anim      = GetComponent <Animator>();   // Inicializa o gerenciador de animações
     player    = GetComponentInParent <Player>();
     am        = FindObjectOfType <AudioManager>();
     audioHurt = am.AddAudio(clipHurt, false, false, 1f);
 }
Ejemplo n.º 5
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            AudioManager audioManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <AudioManager>();
            audioManager.AddAudio(hitClip);

            if (touched == false)
            {
                this.GetComponentInChildren <Renderer>().material.color = Color.green;
                GameObject gameObject = GameObject.FindGameObjectWithTag("GameManager");
                //GameManager gameManager = gameObject.GetComponent<GameManager>();
                LevelManager levelManager = gameObject.GetComponent <LevelManager>();
                levelManager.IncrementDestroyed();
                //NetworkCube colScript = col.gameObject.GetComponent<NetworkCube>();
                //colScript.score += 1;
                touched        = true;
                explosiveTimer = MAXEXPLOSIVETIMER;
                countdownText  = (GameObject)Instantiate(countdownText, this.gameObject.transform.position, Quaternion.identity);
            }

            if (col.gameObject.tag == "Ground")
            {
                DestroyObject(this.gameObject);
            }
        }
    }
Ejemplo n.º 6
0
 // Inicialização
 void Start()
 {
     // Atribui ao objeto no mapa a imagem do consumível associado a ele
     sprite        = GetComponent <SpriteRenderer>();
     sprite.sprite = consumable.image;
     am            = FindObjectOfType <AudioManager>();
     audioGet      = am.AddAudio(clipGet, false, false, 1f);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Assets are loaded in from the CreateResources method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private async void OnCreateResources(CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            _screenSize = new Vector2((float)Cvs.Size.Width, (float)Cvs.Size.Height);

            //set parent canvas for image manager
            ImageManager.ParentCanvas = sender;

            //Animated Hero Images
            await ImageManager.AddImage("Hero_Up_1", @"Assets/Hero_Up_1.gif");

            await ImageManager.AddImage("Hero_Right_1", @"Assets/Hero_Right_1.gif");

            await ImageManager.AddImage("Hero_Left_1", @"Assets/Hero_Left_1.gif");

            await ImageManager.AddImage("Hero", @"Assets/Hero.gif");

            //Minion Images
            await ImageManager.AddImage("MinionLeft", @"Assets/MinionLeft.png");

            await ImageManager.AddImage("MinionRight", @"Assets/MinionRight.png");

            //
            await ImageManager.AddImage("Arrow", @"Assets/Arrow.png");

            await ImageManager.AddImage("Boss", @"Assets/BossEdit.png");

            await ImageManager.AddImage("BossHurt", @"Assets/Boss_Hurt.png");

            await ImageManager.AddImage("Title", @"Assets/Evilution.png");

            await ImageManager.AddImage("GameOver", @"Assets/GameOver.png");

            await AudioManager.AddAudio("Generic Title Scene", "TitleTheme.mp3");

            await AudioManager.AddAudio("Main Game Scene", "BattleTheme.mp3");

            await AudioManager.AddAudio("Game Over Scene", "GameOver.mp3");


            // set up the scene
            var ts = new TitleScene((int)this._screenSize.X, (int)this._screenSize.Y);

            StoryBoard.AddScene(ts);
            StoryBoard.CurrentScene = ts;

            //create scenes
            var game_scene      = new GameScene((int)this._screenSize.X, (int)this._screenSize.Y);
            var game_over_scene = new GameOverScene((int)this._screenSize.X, (int)this._screenSize.Y);

            //add scenes to storyboard
            StoryBoard.AddScene(game_scene);
            StoryBoard.AddScene(game_over_scene);
        }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        rb     = GetComponent <Rigidbody2D>();
        player = Player.FindObjectOfType <Player>();

        if (!player.facingRight)
        {
            speed *= -1;
            Flip();
        }

        am        = FindObjectOfType <AudioManager>();
        audioHurt = am.AddAudio(clipHurt, false, false, 1f);
    }
Ejemplo n.º 9
0
    // Inicialização
    void Start()
    {
        // Atribui ao objeto no mapa a imagem da chave associada a ele
        sprite        = GetComponent <SpriteRenderer>();
        sprite.sprite = key.image;

        am       = FindObjectOfType <AudioManager>();
        audioGet = am.AddAudio(clipGet, false, false, 1f);

        if (Inventory.playerInventory.CheckKey(key))
        {
            Destroy(gameObject);
        }
    }
Ejemplo n.º 10
0
 // Inicialização
 void Start()
 {
     rb              = GetComponent <Rigidbody2D> ();     // Atribui a rb o valor do componente RigidBody dado ao GameObject Player
     anim            = GetComponent <Animator>();         // Inicializa o gerenciador de animações
     attack          = GetComponentInChildren <Attack>(); // Inicializa o componente "Attack"
     sprite          = GetComponent <SpriteRenderer>();   // Inicializa a imagem do jogador
     cameraFollow    = FindObjectOfType <CameraFollow>(); // Inicializa a posição da câmera
     am              = FindObjectOfType <AudioManager>();
     audioJump       = am.AddAudio(clipJump, false, false, 1f);
     audioAttack     = am.AddAudio(clipAttack, false, false, 1f);
     audioFireball   = am.AddAudio(clipFireball, false, false, 1f);
     audioBuffOn     = am.AddAudio(clipBuffOn, false, false, 1f);
     audioConsumable = am.AddAudio(clipConsumable, false, false, 1f);
     audioDamage     = am.AddAudio(clipDamage, false, false, 1f);
     audioDeath      = am.AddAudio(clipDeath, false, false, 1f);
     audioSkill      = am.AddAudio(clipSkill, false, false, 1f);
     SetPlayer();
 }
Ejemplo n.º 11
0
    void Update()
    {
        if (touched == true)
        {
            if (explosiveTimer >= 0.5f)
            {
                explosiveTimer -= Time.deltaTime;
                countdownText.gameObject.GetComponent <TextMesh>().text = ((int)explosiveTimer).ToString();
            }
            else if (explosiveTimer < 0.5f && exploding == false)
            {
                Instantiate(explosion, this.transform.position, this.transform.rotation);

                AudioManager audioManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <AudioManager>();
                audioManager.AddAudio(explosionClip);
                exploding = true;
            }
            else
            {
                Destroy(countdownText.gameObject);
                Destroy(this.gameObject);
            }
        }
    }
Ejemplo n.º 12
0
 void Start()
 {
     am        = FindObjectOfType <AudioManager>();
     audioGold = am.AddAudio(clipGold, false, false, 1f);
 }
Ejemplo n.º 13
0
 void Start()
 {
     am           = FindObjectOfType <AudioManager>();
     audioContact = am.AddAudio(clipContact, false, false, 1f);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Assets are loaded in from the CreateResources method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private async void CanvasControl_CreateResources(CanvasControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            //set parent canvas for image manager
            ImageManager.ParentCanvas = sender;



            #region -------[Load images]

            //Animated Hero Images
            await ImageManager.AddImage("Hero_Up_1", @"Assets/Hero_Up_1.gif");

            await ImageManager.AddImage("Hero_Right_1", @"Assets/Hero_Right_1.gif");

            await ImageManager.AddImage("Hero_Left_1", @"Assets/Hero_Left_1.gif");

            await ImageManager.AddImage("Hero", @"Assets/Hero.gif");

            //Minion Images
            await ImageManager.AddImage("MinionLeft", @"Assets/MinionLeft.png");

            await ImageManager.AddImage("MinionRight", @"Assets/MinionRight.png");

            //
            await ImageManager.AddImage("Arrow", @"Assets/Arrow.png");

            await ImageManager.AddImage("Boss", @"Assets/BossEdit.png");

            await ImageManager.AddImage("BossHurt", @"Assets/Boss_Hurt.png");

            await ImageManager.AddImage("Title", @"Assets/Evilution.png");

            await ImageManager.AddImage("GameOver", @"Assets/GameOver.png");

            #endregion

            #region -------[Load audio]

            await AudioManager.AddAudio("Generic Title Scene", "TitleTheme.mp3");

            await AudioManager.AddAudio("Main Game Scene", "BattleTheme.mp3");

            await AudioManager.AddAudio("Game Over Scene", "GameOver.mp3");

            #endregion

            // set scene
            CanvasControl cc = sender;
            TitleScene    ts = new TitleScene((int)cc.RenderSize.Width, (int)cc.RenderSize.Height);
            StoryBoard.AddScene(ts);
            StoryBoard.CurrentScene = ts;

            //create scenes
            GameScene     game_scene      = new GameScene((int)cc.RenderSize.Width, (int)cc.RenderSize.Height);
            GameOverScene game_over_scene = new GameOverScene((int)cc.RenderSize.Width, (int)cc.RenderSize.Height);

            //add scenes to storyboard
            StoryBoard.AddScene(game_scene);
            StoryBoard.AddScene(game_over_scene);

            IsAllImagesLoaded = true;

            GameTimer gt = new GameTimer(sender, 120, 100);
        }