void Start()
    {
         // Make sure we have stack manager
        if (!stackManager)
        {
            stackManager = Utility.GetComponentFromTag<StackManager>("StackManager");
        }

        // Make sure we have throw manager
        if (!throwManager)
        {
            throwManager = Utility.GetComponentFromTag<ThrowManager>("ThrowManager");
        }

        // Only use PS4 controller settings if we have an active controller
        if (Input.GetJoystickNames().Length > 0)
        {
            usePS4Controller = true;
            Debug.Log("Using PS4 Controller");
        }
        else
        {
            usePS4Controller = false;
            Debug.Log("Using Keyboard Input");
        }

        // Initialise to first animal
        animalIndex = 0;
    }
Example #2
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);
        }
Example #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";
        }
Example #4
0
 public Player(int playerNumber, int xPosition, int yHeight, ComboManager comboManager, ThrowManager throwManager, Gauge healthBar)
 {
     sprite              = new SpriteAnimationManager();
     PlayerNumber        = playerNumber;
     Position            = new Vector2(xPosition, Config.Instance.GroundYHeight - yHeight);
     startingPosition    = new Vector2(xPosition, Config.Instance.GroundYHeight - yHeight);
     ComboManager        = comboManager;
     ThrowManager        = throwManager;
     specialInputManager = new SpecialInputManager();
     SoundManager        = new SoundManager();
     ControlSetting      = new ControlSetting();
     InputMoveBuffer     = new InputMoveBuffer();
     IsPhysical          = true;
     HealthBar           = healthBar;
 }
Example #5
0
    void Start()
    {
        player_rigidbody = GetComponent <Rigidbody>();
        player_state     = GetComponent <PlayerState>();
        throwManager     = GetComponent <ThrowManager>();
        mapChecker       = GetComponentInChildren <MapChecker>();
        followDust       = GetComponentInChildren <ParticleSystem>();

        if (SceneManager.GetActiveScene().name == "Game_SceneNew")
        {
            qick = GameObject.Find("Quick_slot_new").GetComponent <Quick_slot_new>();
        }
        child    = transform.GetChild(0);
        dialogue = GameObject.Find("Dialogue").GetComponent <Dialogue>();
        lookAt   = transform.forward;
        is_run   = false;

        player_mate.color = new Color(1f, 1f, 1f, 1);

        StartCoroutine(soundss());
    }
Example #6
0
 private void Awake()
 {
     Instance = this;
 }
Example #7
0
        public void determineCurrentMove(GameTime gameTime, KeyboardState ks, Boolean inHitstop)
        {
            String moveName = SpecialInputManager.checkMoves(Sprite.CurrentMoveAnimation.CharacterState, Direction, Sprite.CurrentAnimation, ks);

            // See if we are in a state to change moves
            //
            if (IsCancealableMove || // Are we doing an action that can be canceled
                HasHitOpponent ||    // We can also cancel a move if we hit an opponent
                InputMoveBuffer.getBufferedMove() != null)
            {
                if (moveName == null && InputMoveBuffer.getBufferedMove() == null)
                {
                    // Handle basic stuff like moving, jumping and crouching
                    //
                    processBasicMovement(gameTime, ks);
                }
                else if (moveName == "jumpcancel")
                {
                    if (Sprite.CurrentMoveAnimation.CharacterState != CharacterState.AIRBORNE)
                    {
                        if ((IsCancealableMove || HasHitOpponent))
                        {
                            if (ks.IsKeyDown(controlSetting.Controls["right"]))
                            {
                                Jump(Direction.Right);
                            }
                            else if (ks.IsKeyDown(controlSetting.Controls["left"]))
                            {
                                Jump(Direction.Left);
                            }
                            else
                            {
                                Jump();
                            }
                            if (Direction == Direction.Right)
                            {
                                ProjectileManager.createJumpParticle(Position.X, Position.Y + Sprite.CurrentMoveAnimation.FrameHeight, Direction.Left);
                            }
                            else
                            {
                                ProjectileManager.createJumpParticle(Position.X + Sprite.CurrentMoveAnimation.FrameWidth, Position.Y + Sprite.CurrentMoveAnimation.FrameHeight, Direction.Right);
                            }
                        }
                    }
                    else if (Sprite.CurrentMoveAnimation == null ||
                             Sprite.CurrentMoveAnimation.CharacterState == CharacterState.AIRBORNE)
                    {
                        // Jump canceling moves
                        //
                        if ((IsCancealableMove || HasHitOpponent) && timesJumped < airJumpLimit && prevKeyboardState.IsKeyUp(controlSetting.Controls["up"]) && ks.IsKeyDown(controlSetting.Controls["up"]))
                        {
                            timesJumped++;
                            Console.WriteLine(timesJumped);
                            if (ks.IsKeyDown(controlSetting.Controls["right"]))
                            {
                                AirJump(Direction.Right);
                            }
                            else if (ks.IsKeyDown(controlSetting.Controls["left"]))
                            {
                                AirJump(Direction.Left);
                            }
                            else
                            {
                                AirJump();
                            }
                        }
                    }
                }
                else
                {
                    UnCrouch();

                    // If we're trying to do a throw, see if we actually can. if not then change it.
                    //
                    if (moveName == "forwardthrow" || moveName == "backthrow")
                    {
                        // Have the throw manager see if the throw is valid
                        //
                        if (!ThrowManager.isValidThrow(PlayerNumber))
                        {
                            // If its not then have the move perform a throw whiff move
                            // This can work for either 1 button or 2 button
                            //
                            if (moveName == "forwardthrow")
                            {
                                moveName = ThrowManager.ForwardThrowWhiffMove;
                                Console.WriteLine("OOPS WAS NOT A THROW DOING FORWARD C");
                            }
                            else
                            {
                                moveName = ThrowManager.BackThrowWhiffMove;
                            }
                        }
                    }

                    // If we're in hitstop, queue up the move.
                    //
                    if (inHitstop)
                    {
                        if (moveName != null)
                        {
                            Console.WriteLine("Queueing up : " + moveName);
                            InputMoveBuffer.setBufferedMove(moveName);
                        }
                    }
                    // If we're not in hitstop then we're free to perform things
                    //
                    else
                    {
                        // If its appropriate and we have a move queued up then it takes priority
                        //
                        if ((IsCancealableMove || HasHitOpponent) && InputMoveBuffer.getBufferedMove() != null)
                        {
                            Console.WriteLine("Unbuffering Move");
                            checkValidityAndChangeMove(InputMoveBuffer.getBufferedMove());
                            InputMoveBuffer.unbufferCurrentMove();
                        }
                        // Otherwise perform the current move
                        //
                        else if (moveName != null)
                        {
                            if (moveName != "backstep" && moveName != "dash")
                            {
                                checkValidityAndChangeMove(moveName);
                            }
                            else if (timesJumped < 1)
                            {
                                // Doing an airdash or back step
                                //
                                SoundManager.PlaySound(moveName);
                                if (moveName == "dash" && Sprite.CurrentAnimation != "dash")
                                {
                                    ProjectileManager.createDashParticle(Position.X, Position.Y + Sprite.CurrentMoveAnimation.FrameHeight, Direction);
                                }
                                Sprite.CurrentAnimation = moveName;

                                // If we're in the air when we do it, note we jumped up
                                //
                                if (IsAirborne)
                                {
                                    if (Sprite.CurrentAnimation == "dash")
                                    {
                                        Sprite.CurrentAnimation = "airdashstart";
                                        Console.WriteLine(" Start Dashing in the air");
                                    }

                                    timesJumped++;
                                }
                            }
                        }
                    }
                }
            }
            // If we've input a move but cant cancel it, then put it in our buffer
            //
            else if (moveName != null && Sprite.CurrentMoveAnimation.IsAttack && moveName != "backstep")
            {
                Console.WriteLine("Queueing up : " + moveName);
                InputMoveBuffer.setBufferedMove(moveName);
            }
        }
Example #8
0
 // Use this for initialization
 void Start()
 {
     SecretRoomSwitch.SecretRoomOpenend += OnSecretDoorStatusChange;
     throwManager     = GetComponent <ThrowManager>();
     originalPosition = transform.position;
 }
Example #9
0
        public HuntingHornPlayer(int playerNumber, int xPosition, int yHeight, ComboManager comboManager, ThrowManager throwManager, Gauge healthBar)
            : base(playerNumber, xPosition, yHeight, comboManager, throwManager, healthBar)
        {
            CurrentHealth = 1000;
            MaxHealth     = 1000;

            Sprite.BoundingBoxHeight = 288;
            Sprite.BoundingBoxWidth  = 90;

            // TODO make these have to be set for every character.
            //
            ThrowRange     = 200;
            BackAirDashVel = 8;
            AirDashVel     = 13;
            BackStepVel    = 12;
            DashVel        = 11;
            BackWalkVel    = 3;
            WalkVel        = 4;
//            projectile = new ProjectileAnimation(texture, X, Y, Width, Height, Frames, columns, frameLength, characterState, timeLength, direction);
        }
Example #10
0
        public LongSwordPlayer(int playerNumber, int xPosition, int yHeight, ComboManager comboManager, ThrowManager throwManager, Gauge healthBar)
            : base(playerNumber, xPosition, yHeight, comboManager, throwManager, healthBar)
        {
            CurrentHealth = 1000;

            MaxHealth     = 1000;
            DisplayShadow = false;

            // D mechanic related moves
            //
            SwordLevel = 1;


            SwordGaugeGains = new Dictionary <String, int>();
            MoveCosts       = new Dictionary <String, int>();

            SwordGaugeGains.Add("aattack", 5);
            SwordGaugeGains.Add("battack", 10);
            SwordGaugeGains.Add("cattack", 15);
            SwordGaugeGains.Add("2aattack", 5);
            SwordGaugeGains.Add("2battack", 10);
            SwordGaugeGains.Add("2cattack", 15);
            SwordGaugeGains.Add("jaattack", 5);
            SwordGaugeGains.Add("jbattack", 10);
            SwordGaugeGains.Add("jcattack", 15);
            // MoveCosts.Add("battack", 10);
            MoveCosts.Add("backfireball", 0);

            MoveCosts.Add("rekka", 0);
            MoveCosts.Add("rekkaB", 0);
            MoveCosts.Add("rekkaC", 0);

            Sprite.BoundingBoxHeight = 288;
            Sprite.BoundingBoxWidth  = 90;

            // Essentially how many rekkas we've done
            //
            rekkaLevel = 1;

            // TODO make these have to be set for every character.
            //
            ThrowRange     = 200;
            BackAirDashVel = 8;
            AirDashVel     = 13;
            BackStepVel    = 13;
            DashVel        = 8;
            BackWalkVel    = 3;
            WalkVel        = 4;
//            projectile = new ProjectileAnimation(texture, X, Y, Width, Height, Frames, columns, frameLength, characterState, timeLength, direction);
        }
Example #11
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");
        }