Exemplo n.º 1
0
    public void ChangeMenu(CombatMenu m)
    {
        currentMenu      = m;
        currentSelection = 1;
        Debug.Log(m);
        switch (m)
        {
        case CombatMenu.Main:
            MainMenu.gameObject.SetActive(true);
            SideInfo.gameObject.SetActive(true);
            SkillsMenu.gameObject.SetActive(false);
            SkillsInfo.gameObject.SetActive(false);
            InfoMenu.gameObject.SetActive(false);
            break;

        case CombatMenu.Fight:
            MainMenu.gameObject.SetActive(false);
            SideInfo.gameObject.SetActive(false);
            SkillsMenu.gameObject.SetActive(true);
            SkillsInfo.gameObject.SetActive(true);
            InfoMenu.gameObject.SetActive(false);
            break;

        case CombatMenu.Info:
            MainMenu.gameObject.SetActive(false);
            SideInfo.gameObject.SetActive(false);
            SkillsMenu.gameObject.SetActive(false);
            SkillsInfo.gameObject.SetActive(false);
            InfoMenu.gameObject.SetActive(true);
            break;
        }
    }
Exemplo n.º 2
0
    private void Start()
    {
        objectPooler = ObjectPooler.Instance;
        playerScript = PlayerScript.Instance;
        GameObject _tempCanvas = GameObject.Find("Canvas");

        canvasAnim = _tempCanvas.GetComponent <Animator>();
        combatMenu = _tempCanvas.GetComponent <CombatMenu>();
        cardHolder = GameObject.Find("PlayerCanvas").GetComponent <CardHolder>();
    }
Exemplo n.º 3
0
	// Use this for initialization
	void Start () {
		ObjectTooltip.Hide ();
		selectionMode = SelectionModes.None;
		instance = this;
		attackButton = transform.Find ("AttackButton").GetComponent<Button> ();
		abilityButton = transform.Find ("AbilityButton").GetComponent<Button> ();
		itemButton = transform.Find ("ItemButton").GetComponent<Button> ();
		attackButton.gameObject.SetActive (false);
		abilityButton.gameObject.SetActive (false);
		itemButton.gameObject.SetActive (false);
	}
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        _hero           = Hero.active;
        defeatedEnemies = new List <Creature>();
        turnOrder       = new List <GameObject>();

        combatMenu = FindObjectOfType <CombatMenu>();
        InputManager.im.notifyActionButtonObservers += PlayerAttack;

        SpawnEnemies();
        MainCombatLoop();

        //starts okayer turn countdown
        StartPlayerWait();
    }
Exemplo n.º 5
0
    public IEnumerator chooseSkill(TextManager manager, CombatInstance instance)
    {
        bool       skillChosen = false;
        CombatMenu currMenu    = CombatMenu.Start;

        while (!skillChosen)
        {
            manager.setupMenu(getOptions(currMenu, instance));
            while (manager.mode != TextManager.ManagerMode.Standby)
            {
                yield return(null);
            }
            navigateMenu(currMenu, instance, manager.output);
            skillChosen = true;
        }
    }
Exemplo n.º 6
0
    public void SendSkills()
    {
        foreach (var character in BattleManager.instance.characters)
        {
            Hero  hero  = character.GetComponent <Hero>();
            Enemy enemy = character.GetComponent <Enemy>();

            if (hero != null && hero.character.state == Character.StateMachine.ACTION)
            {
                foreach (var skill in hero.character.skills.skillsAvailable)
                {
                    if (skill.slot == slotType)
                    {
                        CombatMenu cM = CanvasScript.instance.CombatMenuObject.GetComponent <CombatMenu>();
                        cM.Skill(skillData);
                    }
                }
            }
        }
    }
Exemplo n.º 7
0
    private string[] getOptions(CombatMenu menu, CombatInstance instance)
    {
        List <string> result = new List <string>();

        if (menu == CombatMenu.Start)
        {
            result.Add("Attack");
            result.Add("Skill");
            result.Add("Move");
        }
        else if (menu == CombatMenu.Skills)
        {
            foreach (Skill.SkillName skill in skills)
            {
                result.Add(skill.ToString());
            }
        }
        else if (menu == CombatMenu.Target)
        {
            int  postFix = 0;
            bool incr    = false;

            if (instance.enemies.Count > 1)
            {
                postFix = 1;
                incr    = true;
            }

            foreach (Enemy enemy in instance.enemies)
            {
                if (incr)
                {
                    postFix++;
                }

                result.Add(enemy.combatName + (incr ? " " + postFix : ""));
            }
        }

        return(result.ToArray());
    }
Exemplo n.º 8
0
        public override void _Ready()
        {
            _map             = GetNode <YSort>("Map");
            _enemySpawns     = GetNode <Node2D>("EnemySpawns");
            _combat          = GetNode <Combat>("Combat");
            _combatMenu      = _combat.GetNode <CombatMenu>("CombatMenu");
            _pauseMenu       = GetNode <PauseMenu>("PauseMenu");
            _player          = _map.GetNode <Player>("Player");
            _droppedItemsGUI = GetNode <DroppedItems>("DroppedItems");

            _player.birdsSystem.Visible  = true;
            _player.cloudsSystem.Visible = true;

            _player.Position = SaveManager.SaveData.WorldPosition;

            if (!AudioSystem.IsMusicPlaying)
            {
                AudioSystem.PlayMusic(AudioSystem.MusicCollection.Overworld);
            }

            SpawnEnemies();
        }
 private void Start()
 {
     combatMenu = GameObject.Find("Canvas").GetComponent <CombatMenu>();
 }
Exemplo n.º 10
0
 private void navigateMenu(CombatMenu menu, CombatInstance instance, int option)
 {
 }
Exemplo n.º 11
0
    // Update is called once per frame
    void Update()
    {
        if (isPaused == false)
        {
            if (isLerping == false)
            {
                if (Input.GetButtonDown("MoveUp"))
                {
                    if ((int)currentTileClass.gridLocation.y + movementRange < bfs.yMax && TileCheck(0, movementRange))
                    {
                        MovePlayer(MoveDirection.Up);
                    }
                }
                else if (Input.GetButtonDown("MoveDown"))
                {
                    if ((int)currentTileClass.gridLocation.y - movementRange >= 0 && TileCheck(0, -movementRange))
                    {
                        MovePlayer(MoveDirection.Down);
                    }
                }
                else if (Input.GetButtonDown("MoveLeft"))
                {
                    if ((int)currentTileClass.gridLocation.x - 1 >= 0 && TileCheck(-movementRange, 0))
                    {
                        MovePlayer(MoveDirection.Left);
                    }
                }
                else if (Input.GetButtonDown("MoveRight"))
                {
                    if ((int)currentTileClass.gridLocation.x + 1 < bfs.xMax && TileCheck(movementRange, 0))
                    {
                        MovePlayer(MoveDirection.Right);
                    }
                }


                #region consoleInput
                else if (Input.GetAxisRaw("MoveVertical") != 0)
                {
                    if (vertAxisInUse == false)
                    {
                        if (Input.GetAxisRaw("MoveVertical") < 0)
                        {
                            if ((int)currentTileClass.gridLocation.y - movementRange >= 0 && TileCheck(0, -movementRange))
                            {
                                MovePlayer(MoveDirection.Down);
                            }
                        }
                        else if (Input.GetAxisRaw("MoveVertical") > 0)
                        {
                            if ((int)currentTileClass.gridLocation.y + movementRange < bfs.yMax && TileCheck(0, movementRange))
                            {
                                MovePlayer(MoveDirection.Up);
                            }
                        }
                    }
                }
                else if (Input.GetAxisRaw("MoveHorizontal") != 0)
                {
                    if (horizontalAxisInUse == false)
                    {
                        if (Input.GetAxisRaw("MoveHorizontal") < 0)
                        {
                            if ((int)currentTileClass.gridLocation.x - 1 >= 0 && TileCheck(-movementRange, 0))
                            {
                                MovePlayer(MoveDirection.Left);
                            }
                        }
                        if (Input.GetAxisRaw("MoveHorizontal") > 0)
                        {
                            if ((int)currentTileClass.gridLocation.x + 1 < bfs.xMax && TileCheck(movementRange, 0))
                            {
                                MovePlayer(MoveDirection.Right);
                            }
                        }
                    }
                }

                #endregion
                ContinuousMovement();
                if (Input.GetButton("Shoot"))
                {
                    shotChargeAmount += Time.deltaTime;
                    if (shotChargeAmount < maxShotChargeTime && shotChargeAmount > 0.05f)
                    {
                        if (chargeParticles[0].isPlaying == false)
                        {
                            chargeParticles[0].Play();
                        }
                    }
                    else if (shotChargeAmount >= maxShotChargeTime && shotFullyCharged == false)
                    {
                        chargeParticles[0].Stop();
                        chargeParticles[1].Play();
                        shotFullyCharged = true;
                    }
                }
                if (Input.GetButtonUp("Shoot") && canShoot == true)
                {
                    canShoot = false;

                    ClearChargeParticles();

                    if (shotFullyCharged == false)
                    {
                        standardShot.Shoot(spellOrigin[0].transform, gameObject);

                        anim.Play("Attack");

                        //objectPooler.SpawnFromPool("PlayerBullet", spellOrigin.transform.position, Quaternion.Euler(0, 0, 90), gameObject.transform);
                    }
                    else
                    {
                        //objectPooler.SpawnFromPool("ChargedPlayerBullet", spellOrigin.transform.position, Quaternion.Euler(0, 0, 90), gameObject.transform);
                        ShootCharged();
                    }
                    shootEvent?.Invoke();

                    shotChargeAmount = 0;

                    StartCoroutine(ShotDelay());
                }

                if (Input.GetButtonDown("Use"))
                {
                    if (cardHolder.spellMiniatures.Count > 0)
                    {
                        cardHolder.UseSpell(gameObject, status, spellOrigin[0].transform);
                        anim.Play("Spell");
                        spellParticles.Play();
                    }
                }
            }



            if (Input.GetAxisRaw("MoveVertical") == 0)
            {
                vertAxisInUse = false;
            }
            if (Input.GetAxis("MoveHorizontal") == 0)
            {
                horizontalAxisInUse = false;
            }



            if (Input.GetButtonUp("StartTurn") && turnBarScript.CurrentTurnTime >= turnBarScript.MaxTurnTime)
            {
                if (isPaused == false)
                {
                    //objectPooler.PauseAll();


                    CombatMenu _tempCombatMenu = canvasAnim.gameObject.GetComponent <CombatMenu>();

                    List <SpellCard> _tempSpellList = new List <SpellCard>();

                    foreach (SpellCard s in _tempCombatMenu.playerCombatInUse)
                    {
                        _tempSpellList.Add(s);
                    }

                    foreach (SpellCard s in _tempSpellList)
                    {
                        _tempCombatMenu.MoveCardToDestination(s, CardDestination.Combat, CardDestination.Graveyard);
                    }

                    cardHolder.Purge();
                    turnBarScript.Pause(false);

                    canvasAnim.Play("MenuSlideIn");

                    //EventSystem.current.SetSelectedGameObject(null);
                    //EventSystem.current.SetSelectedGameObject(firstButton);
                }
                else
                {
                    //canvasAnim.Play("MenuSlideOut");

                    //EventSystem.current.SetSelectedGameObject(null);
                    //objectPooler.UnPauseAll();
                }
            }
        }
    }
Exemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     instance = this;
 }