Пример #1
0
    private void Awake()
    {
        if (instancia == null)
        {
            instancia = this;
            //Para cada elemento del arreglo vamos a asignarle los elementos de Sound al componente AudioSource
            foreach (Sound s in sounds)
            {
                s.source      = gameObject.AddComponent <AudioSource>();
                s.source.clip = s.clip;

                s.source.volume = s.volume;
                s.source.pitch  = s.pitch;
                s.source.loop   = s.loop;
                s.source.outputAudioMixerGroup = s.audioMixerGroup;
            }
            DontDestroyOnLoad(gameObject);
            PlaySound("TemaPrincipal");
        }

        else
        {
            Destroy(gameObject);
            return;
        }

        //DontDestroyOnLoad(gameObject);
    }
Пример #2
0
 public override void cleanUp()
 {
     base.cleanUp();
     if (!Sprite.CurrentMoveAnimation.IsAttack)
     {
         rekkaLevel = 1;
         SuperManager.endSuper(PlayerNumber);
         DisplayShadow = false;
         IsPhysical    = true;
     }
 }
Пример #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            cam       = new Camera2d(Config.Instance.GameWidth, Config.Instance.ScreenWidth, Config.Instance.GameHeight, Config.Instance.ScreenHeight);
            cam.Pos   = new Vector2(512.0f, 360.0f);
            mainFrame = new Rectangle(-450, 0, 2400, Config.Instance.GameHeight);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            spriteFont   = Content.Load <SpriteFont>("testf");
            comboManager = new ComboManager(spriteFont);

            BGMManager bgmManager = new BGMManager(Content);

            projectileManager = new ProjectileManager(Content);
            throwManager      = new OneButtonThrowManager();
            superManager      = new BasicSuperManager(cam);

            menuBg = Content.Load <Texture2D>("bg2");

            dummyTexture = new Texture2D(GraphicsDevice, 1, 1);

            dummyTexture.SetData(new Color[] { Color.White });


            testHitbox = new Rectangle(100, 100, 100, 100);

            testHitInfo = new HitInfo(3, 20, Hitzone.HIGH);
            testHitInfo.IsHardKnockDown = true;
            testHitInfo.AirUntechTime   = 8000;
            testHitInfo.AirXVelocity    = 80;
            testHitInfo.AirYVelocity    = -100;

            effect = Content.Load <SoundEffect>("slap_large");

            characterSelection = new CharacterSelectList(Content);

            player1CharacterId = "HuntingHorn";


            PlayerFactory playerFactory = new PlayerFactory();

            playerFactory.DummyTexture = dummyTexture;
            player1 = (HuntingHornPlayer)playerFactory.createCharacter(player1CharacterId, Content, 1, comboManager, throwManager, superManager, projectileManager);

            //player1.Sprite.a
            roundManager   = new RoundManager(player1, player2);
            animationsList = player1.Sprite.AnimationsList;
            player1.Sprite.CurrentAnimation      = animationsList[index];
            player1.Sprite.CurrentAnimation      = "hit";
            player1.ProjectileA.CurrentAnimation = "note1";
        }
Пример #4
0
 public void PerformSuperFreeze()
 {
     SuperManager.performSuper(PlayerNumber, Sprite.PositionCenter);
 }
Пример #5
0
        public Player createCharacter(String CharacterId, ContentManager content, int playerNumber,
                                      ComboManager comboManager, ThrowManager throwManager, SuperManager superManager, ProjectileManager projectileManager)
        {
            Player player;

            int       xPosition;
            int       healthBarMargin;
            Texture2D healthBar       = content.Load <Texture2D>("healthBar1");
            Texture2D healthOuterBar  = content.Load <Texture2D>("HealthBar_empty");
            Texture2D specialBar      = content.Load <Texture2D>("specialbar2");
            Texture2D specialOuterBar = content.Load <Texture2D>("Special_4split_empty");
            Direction direction;

            if (playerNumber == 1)
            {
                xPosition       = Config.Instance.Player1XPosition;
                healthBarMargin = ((Config.Instance.ScreenWidth / 2) - 600) / 2;
                direction       = Direction.Right;
            }
            else
            {
                xPosition       = Config.Instance.Player2XPosition;
                healthBarMargin = (((Config.Instance.ScreenWidth / 2) - 600) / 2) + (Config.Instance.ScreenWidth / 2);
                direction       = Direction.Left;
            }
            Gauge HealthBar = new Gauge(healthBar, 20, healthBarMargin, playerNumber, 10, new Rectangle(0, 0, 1276, 150));

            HealthBar.OuterBarTexture = healthOuterBar;
            if (CharacterId.Equals("LongSword"))
            {
                player = new LongSwordPlayer(playerNumber, xPosition, Config.Instance.PlayerYHeight, comboManager, throwManager, HealthBar);
            }
            else if (CharacterId.Equals("HuntingHorn"))
            {
                player = new HuntingHornPlayer(playerNumber, xPosition, Config.Instance.PlayerYHeight + 50, comboManager, throwManager, HealthBar);
            }
            else
            {
                player = new LongSwordPlayer(playerNumber, xPosition, Config.Instance.PlayerYHeight, comboManager, throwManager, HealthBar);
            }
            player.SuperManager        = superManager;
            player.ProjectileManager   = projectileManager;
            player.Sprite.dummyTexture = DummyTexture;

            player.SpecialBar = new Gauge(specialBar, 675, healthBarMargin + 90, playerNumber, 15, new Rectangle(0, 0, 934, 68));
            player.SpecialBar.CurrentAmount   = 100;
            player.SpecialBar.MaxAmount       = 100;
            player.SpecialBar.OuterBarTexture = specialOuterBar;

            player.Direction = direction;
            player.setUpGauges(content, healthBarMargin + 90);

            loadCharacterDataConfigs(CharacterId, player, content);
            loadParticles(CharacterId, player, content);
            player.SetUpUniversalAttackMoves();

            return(player);
        }
Пример #6
0
        public override void performGroundSpecialMove(KeyboardState ks, String moveName)
        {
            if (moveName == "fireball")
            {
                Fireball();
            }
            if (moveName == "supera")
            {
                DisplayShadow = true;
                if (Direction == Direction.Left)
                {
                    Sprite.MoveBy(-Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                }
                else
                {
                    Sprite.MoveBy(Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                }
            }
            if (moveName == "superaending")
            {
                if (Sprite.isLastFrameOfAnimation())
                {
                    // Tell the super manager that the special is over
                    //
                    SuperManager.endSuper(PlayerNumber);
                    Console.WriteLine("SPECIAL IS NOW OVER YAY");
                }
            }
            else if (moveName == "superafollowup")
            {
                if (Direction == Direction.Left)
                {
                    Sprite.MoveBy(-Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                }
                else
                {
                    Sprite.MoveBy(Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                }
            }
            else if (moveName == "superaslash")
            {
                if (Sprite.CurrentMoveAnimation.CurrentFrame >= 0 && Sprite.CurrentMoveAnimation.CurrentFrame < 4)
                {
                    IsPhysical = false;

                    if (Direction == Direction.Left)
                    {
                        Sprite.MoveBy(-Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                    }
                    else
                    {
                        Sprite.MoveBy(Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                    }
                    GivePlayerMomentum(7, 3, true);
                }
                else
                {
                    IsPhysical = true;
                }
                if (Sprite.isLastFrameOfAnimation() && Sprite.CurrentMoveAnimation.HasHitOpponent && !Sprite.CurrentMoveAnimation.Blocked)
                {
                    Sprite.CurrentAnimation = "superaending";
                }
            }
            else if (moveName == "aattack")
            {
            }
            else if (moveName == "cattack")
            {
                // This seems kinda clumsy to perform every c attack. Maybe we should keep a reference the the projectile instead of cloning it.
                //
                List <Projectile> projectiles = ProjectileManager.getPlayerProjectiles(PlayerNumber);
                for (int i = projectiles.Count - 1; i >= 0; i--)
                {
                    if (Sprite.Hitbox.Intersects(projectiles[i].Hitbox))
                    {
                        projectiles[i].CurrentAnimation = "projectile";
                    }
                }
            }
            else if (moveName == "rekka")
            {
                if (Direction == Direction.Left)
                {
                    Sprite.MoveBy(-5, 0);
                }
                else
                {
                    Sprite.MoveBy(5, 0);
                }
            }
            else if (moveName == "rekkaB")
            {
                if (Sprite.CurrentMoveAnimation.CurrentFrame > 3 && Sprite.CurrentMoveAnimation.CurrentFrame < 11)
                {
                    if (Direction == Direction.Left)
                    {
                        Sprite.MoveBy(-20, 0);
                    }
                    else
                    {
                        Sprite.MoveBy(20, 0);
                    }
                }
            }
            else if (moveName == "rekkaC")
            {
                if (Sprite.CurrentMoveAnimation.CurrentFrame > 4 && Sprite.CurrentMoveAnimation.CurrentFrame < 8)
                {
                    IsPhysical = false;
                    if (Direction == Direction.Left)
                    {
                        Sprite.MoveBy(-Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                    }
                    else
                    {
                        Sprite.MoveBy(Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                    }
                    GivePlayerMomentum(7, 3, true);
                }
                else
                {
                    IsPhysical = true;
                }
            }


            else if (moveName == "superaending")
            {
            }
            else if (moveName == "specialcommand")
            {
                if (Sprite.CurrentMoveAnimation.CurrentFrame > 4 && Sprite.CurrentMoveAnimation.CurrentFrame < 8)
                {
                    IsPhysical = false;
                    if (Direction == Direction.Left)
                    {
                        Sprite.MoveBy(Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                    }
                    else
                    {
                        Sprite.MoveBy(-Sprite.CurrentMoveAnimation.CurrentXMovementInfo, 0);
                    }
                    GivePlayerMomentum(7, 3, true);
                }
                else
                {
                    IsPhysical = true;
                }
            }
            else if (moveName == "backfireball")
            {
                BackFireball();
            }
            else
            {
                base.performGroundSpecialMove(ks, moveName);
            }
        }
Пример #7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            cam    = new Camera2d(Config.Instance.GameWidth, Config.Instance.ScreenWidth, Config.Instance.GameHeight, Config.Instance.ScreenHeight);
            layers = new List <Layer>
            {
                new Layer(cam)
                {
                    Parallax = new Vector2(0.2f, 1.0f)
                },
                new Layer(cam)
                {
                    Parallax = new Vector2(0.3f, 1.0f)
                },
                new Layer(cam)
                {
                    Parallax = new Vector2(0.4f, 1.0f)
                },
                new Layer(cam)
                {
                    Parallax = new Vector2(0.8f, 1.0f)
                },
                new Layer(cam)
                {
                    Parallax = new Vector2(1.0f, 1.0f)
                },
                new Layer(cam)
                {
                    Parallax = new Vector2(1.0f, 1.0f)
                }
            };

            Texture2D test = Content.Load <Texture2D>("new_groundplane");

            layers[0].Sprites.Add(new BackgroundObject {
                texture = Content.Load <Texture2D>("background"), mainFrame = new Rectangle(-100, 0, 2200, Config.Instance.GameHeight)
            });
            layers[1].Sprites.Add(new BackgroundObject {
                texture = Content.Load <Texture2D>(@"main_castle"), mainFrame = new Rectangle(-100, 275, 2200, Config.Instance.GameHeight - 300)
            });
            layers[2].Sprites.Add(new BackgroundObject {
                texture = Content.Load <Texture2D>(@"midground"), mainFrame = new Rectangle(-100, 100, 2200, Config.Instance.GameHeight)
            });
            //layers[3].Sprites.Add(new BackgroundObject { texture = Content.Load<Texture2D>(@"foreground"), mainFrame = new Rectangle(-100, 0, 2200, Config.Instance.GameHeight) });
            layers[4].Sprites.Add(new BackgroundObject {
                texture = Content.Load <Texture2D>(@"new_groundplane"), mainFrame = new Rectangle(500, 0, 2200, Config.Instance.GameHeight)
            });
            //cam.Pos = new Vector2(Config.Instance.GameWidth/2, 360.0f);
            mainFrame = new Rectangle(-150, -450, 2200, Config.Instance.GameHeight);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            spriteFont   = Content.Load <SpriteFont>("slant");
            ingameFont   = Content.Load <SpriteFont>("arvil");
            comboManager = new ComboManager(ingameFont);

            BGMManager bgmManager = new BGMManager(Content);

            projectileManager = new ProjectileManager(Content);
            throwManager      = new OneButtonThrowManager();
            superManager      = new BasicSuperManager(cam);
            //background = Content.Load<Texture2D>("background");
            //background2 = Content.Load<Texture2D>("main_castle");

            menuBg = Content.Load <Texture2D>("bg2");

            victoryDots = Content.Load <Texture2D>("winDots");

            dummyTexture = new Texture2D(GraphicsDevice, 1, 1);

            dummyTexture.SetData(new Color[] { Color.White });


            testHitbox = new Rectangle(100, 100, 100, 100);

            testHitInfo = new HitInfo(3, 20, Hitzone.HIGH);
            testHitInfo.IsHardKnockDown = true;
            testHitInfo.AirUntechTime   = 8000;
            testHitInfo.AirXVelocity    = 80;
            testHitInfo.AirYVelocity    = 2;

            effect = Content.Load <SoundEffect>("hit_3");
            hit2   = Content.Load <SoundEffect>("hit_4");
            slash  = Content.Load <SoundEffect>("stab_1");
            slash2 = Content.Load <SoundEffect>("stab_2");
            strum  = Content.Load <SoundEffect>("strum_1");

            //MediaPlayer.Play(bgmManager.getRandomBGM());
            //MediaPlayer.Volume = 0.4f;

            player1Controls.setControl("down", Keys.Down);
            player1Controls.setControl("right", Keys.Right);
            player1Controls.setControl("left", Keys.Left);
            player1Controls.setControl("up", Keys.Up);
            player1Controls.setControl("a", Keys.A);
            player1Controls.setControl("b", Keys.S);
            player1Controls.setControl("c", Keys.D);
            player1Controls.setControl("d", Keys.Z);
            player1Controls.setControl("start", Keys.Enter);

            player2Controls.setControl("down", Keys.K);
            player2Controls.setControl("right", Keys.L);
            player2Controls.setControl("left", Keys.J);
            player2Controls.setControl("up", Keys.I);
            player2Controls.setControl("a", Keys.F);
            player2Controls.setControl("b", Keys.G);
            player2Controls.setControl("c", Keys.H);
            player2Controls.setControl("d", Keys.V);
            player2Controls.setControl("start", Keys.End);

            characterSelection = new CharacterSelectList(Content);
            gameState          = GameState.MAINMENU;
            player1CharacterId = "LongSword";

            player2CharacterId = "HuntingHorn";

            pauseMenu = new PauseMenu(spriteFont);

            pressStart = Content.Load <Texture2D>("press_start");
            mainMenu   = new MainMenu(spriteFont, pressStart);

            titleScreen   = Content.Load <Texture2D>("Rising_Force_Title");
            loadingScreen = Content.Load <Texture2D>("VS_Screen");
            demoEndScreen = Content.Load <Texture2D>("thank_you");

            player1NamePlate = Content.Load <Texture2D>("Liara_game_text");
            player2NamePlate = Content.Load <Texture2D>("Aydin_game_text");
        }