public void ExitState(CharStateManager thisCharacter)
 {
     Debug.Log("Exiting State in idleInactiveState");
     //don't worry abourt undoing in this state.
     //let the next states Init method do the changing of anims
     thisCharacter.idleInactiveRig.SetActive(false);
 }
 public void AddCharacterToList(CharStateManager newCharacter)
 {
     if (newCharacter != null)
     {
         currentCharacters.Add(newCharacter);
     }
 }
    public ICharState DoState(CharStateManager thisCharacter)
    {
        Debug.Log("CurrentState is idleINACTIVE state");
        //return some iCharState or null FOR NOW
        // this can only transition to IdleActive or HURT
        //condition should be... if a player is selected
        if (thisCharacter.isHurt)
        {
            this.ExitState(thisCharacter);
            return(thisCharacter.hurtState);
        }


        if (thisCharacter.isSelected)
        {
            //if this character is selected, then switch to IdleActive state, and in that state play the idleActiveAnim
            Debug.Log("thisCharacter.isSelected is true");
            this.ExitState(thisCharacter);
            return(thisCharacter.idleActiveState);
        }
        else
        {
            //play character idle inactive anim, return same state.
            //ACTUALLY, WE DO THAT IN THE INIT STATE!
            return(thisCharacter.idleInactiveState);
        }
        //this state can only go to HURT. or active Idle
    }
Example #4
0
    public new void Start()
    {
        base.Start();

        _charStateManager = new CharStateManager(charState);
        _decisionMaker    = new DecisionMaker(charSheet, _charStateManager, questManager);
    }
Example #5
0
 public ICharState DoState(CharStateManager thisCharacter)
 {
     Debug.Log("CurrentState is IdleActiveState");
     //we must do it this way because ATTACKING takes precedence.
     //this is very bad code because you don't know who the hell toggles isAttacking to true to begin with.
     //we know its UI_ANIMControlller but still
     if (thisCharacter.isAttacking)
     {
         this.ExitState(thisCharacter);
         return(thisCharacter.attackState);
     }
     else if (thisCharacter.isSelected == false)
     {
         this.ExitState(thisCharacter);
         return(thisCharacter.idleInactiveState);
     }
     else if (thisCharacter.isBuffing)
     {
         this.ExitState(thisCharacter);
         return(thisCharacter.buffState);
     }
     else
     {
         //return our current state.
         return(thisCharacter.idleActiveState);
     }
 }
    private void ShowCharCommandUI(PointerEventData selectedChar)
    {
        if (connieHealthBar == null || chrisHealthBar == null)
        {
            connieHealthBar = GameObject.FindWithTag("connieHealthBar");
            chrisHealthBar  = GameObject.FindWithTag("chrisHealthBar");
        }
        connieHealthBar.SetActive(false);
        chrisHealthBar.SetActive(false);
        curCharPortrait = selectedChar.selectedObject;
        curCharIndex    = curCharPortrait.GetComponent <CharSelectPortrait>().charSelectIndex;
        CharStateManager owner = curCharPortrait.GetComponent <CharSelectPortrait>().GetOwner();

        owner.isSelected = true;
        RectTransform rectTransform = curCharPortrait.GetComponent <RectTransform>();

        foreach (var charPortrait in partySelectPortraits)
        {
            if (charPortrait != curCharPortrait)
            {
                charPortrait.SetActive(false);
            }
        }
        ShowSkipTurnButton(false);
        setVisible_AffinityChart(false);
        setVisible_BackButton(true);
        Vector3 targetPosition = gameManager.targetPortraitPosition.Value;

        MoveInactiveCommandPanels(curCharIndex);
        IsAnimating(true);
        ShowCharacterName();
        curCharPortrait.GetComponent <Moveable>().MoveTo(targetPosition, ToggleCommandPanels, ToggleArrows, ResetPortraitPosition, () => IsAnimating(false));
    }
    private void RelayAttack(PointerEventData eventData)
    {
        if (currentSelectedSkill == "")
        {
            return;
        }
        //this isDisabled line may not even have to run because...were going to block it from coming into ui_anim at all.
        if (currentSelectedSkillObject.IsDisabled())
        {
            return;
        }
        CharStateManager owner = currentSelectedSkillOwner;

        //check first with that owner.skillCost > 0
        //if so, owner.InitAttack(currentSelectedSKill), then disableSkill() and resetSkillSelection(); and owner skillCost--;
        if (owner.skillCostRemaining > 0)
        {
            owner.InitAttack(currentSelectedSkill);
            currentSelectedSkillObject.DisableSkill();
            ResetCurrentSkillSelection();
        }
        else
        {
            //ELSE that means we are out of skills. so invoke an "OUT OF SKILL POINTS" event that the MASTER ANIMATOR listens to.
            //after invoking it, disable that last un-usable skill via currentSleected disablskill() and ResetCurrentSkillSellection()
            //now all skills are un-interactable.!
            //invoke OUT OF SKILL POINTS method here.
            StartCoroutine(ShowSkillCostDepletedBubble());
            currentSelectedSkillObject.DisableSkill();
            ResetCurrentSkillSelection();
        }
        //remember to re-enable skills with TurnSystem.CS
    }
 public ICharState DoState(CharStateManager thisCharacter)
 {
     if (thisCharacter.animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
     {
         this.ExitState(thisCharacter);
         return(thisCharacter.idleInactiveState);
     }
     else
     {
         return(thisCharacter.hurtState);
     }
 }
 public void InitState(CharStateManager thisCharacter)
 {
     //activate rig, play animation.
     thisCharacter.attackRig.SetActive(true);
     thisCharacter.animator.Play(thisCharacter.CHAR_ATTACK);
     SoundManager.Instance.Play(thisCharacter.attackAudioList[Random.Range(0, thisCharacter.attackAudioList.Count - 1)]);
     thisCharacter.currentSkillObject.PlaySkillAnimation(GameManager.bossPosition);
     thisCharacter.DecrementSkillCost();
     //invoke a delegate here to let BossState and anyone elser who cares that this player has begun an attack.
     // you can even pass thisCharacter as an argument
     // AH YES..PASS IN A DELAY FLOAT DEPENDING ON THE SKILL
     // thisCharacter.playerAttackStart?.Invoke(0);
 }
Example #10
0
 public void InitState(CharStateManager thisCharacter)
 {
     thisCharacter.buffRig.SetActive(true);
     thisCharacter.animator.Play(thisCharacter.CHAR_BUFF);
     SoundManager.Instance.Play(thisCharacter.attackAudioList[Random.Range(0, thisCharacter.attackAudioList.Count - 1)]);
     thisCharacter.DecrementSkillCost();
     //because this is a buff..we need to make sure this plays in 3 diff positions...so...just call it 3 times!
     //each with the proper ally positions
     foreach (var character in thisCharacter.gameManager.currentCharacters)
     {
         //debug this later to ffind out the type.
         thisCharacter.currentSkillObject.PlaySkillAnimation(character.transform.position);
     }
 }
Example #11
0
 public ICharState DoState(CharStateManager thisCharacter)
 {
     //we're only in buff state up until the animation finishes playing.
     //do what we did in attack state then.
     if (thisCharacter.animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
     {
         //animation has finished.
         //BuffState can only go back to activeState just fyi
         this.ExitState(thisCharacter);
         return(thisCharacter.idleActiveState);
     }
     else
     {
         return(thisCharacter.buffState);
     }
 }
 public ICharState DoState(CharStateManager thisCharacter)
 {
     Debug.Log("CurrentState is Attack");
     //PERFORM YOUR ATTACK
     //all we do here is make sure the animation is finished playing
     //Debug.Log($"The current value of AnimatorStateInfo(0).noramlizedTime is : {thisCharacter.animator.GetCurrentAnimatorStateInfo(0).normalizedTime }");
     if (thisCharacter.animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
     {
         //we have finished playing attack animation, now return idleActive
         this.ExitState(thisCharacter);
         return(thisCharacter.idleActiveState);
     }
     else
     {
         return(thisCharacter.attackState);
     }
 }
Example #13
0
 void Start()
 {
     CharacterControl.characterStateChange += ChangeCharacterState;
     InitializeCharacterDictionary();
     if (charStateChangers.Length <= 0)
     {
         Debug.LogWarning("No character state changers set up");
         Debug.Break();
     }
     else
     {
         charStateManager = ScriptableObject.CreateInstance(typeof(CharStateManager)) as CharStateManager;
         foreach (CharStateChanges csc in charStateChangers)
         {
             csc.SetStateManager(charStateManager);
         }
     }
 }
Example #14
0
 public void SetOwner(CharStateManager owner)
 {
     this.owner = owner;
     ownerHasBeenSet?.Invoke();
 }
 public void SetStateManager(CharStateManager csm)
 {
     charStateManager = csm;
 }
 public void ExitState(CharStateManager thisCharacter)
 {
     thisCharacter.isHurt = false;
     thisCharacter.hurtRig.SetActive(false);
 }
 public void SetOwner(CharStateManager owner)
 {
     this.owner = owner;
 }
 public void ExitState(CharStateManager thisCharacter)
 {
     thisCharacter.attackRig.SetActive(false);
     thisCharacter.isAttacking = false;
 }
 public void InitState(CharStateManager thisCharacter)
 {
     thisCharacter.hurtRig.SetActive(true);
     SoundManager.Instance.Play(thisCharacter.hurtAudioList[Random.Range(0, thisCharacter.hurtAudioList.Count)]);
     thisCharacter.animator.Play(thisCharacter.CHAR_HURT);
 }
Example #20
0
 public void ExitState(CharStateManager thisCharacter)
 {
     thisCharacter.buffRig.SetActive(false);
     thisCharacter.isBuffing = false;
 }
Example #21
0
 public void InitState(CharStateManager thisCharacter)
 {
     thisCharacter.idleActiveRig.SetActive(true);
     thisCharacter.animator.Play(thisCharacter.CHAR_ACTIVE_IDLE);
 }
 private void SetCurrentSkillSelected(SkillData skillData)
 {
     currentSelectedSkill       = skillData.GetSkillName();
     currentSelectedSkillObject = skillData;
     currentSelectedSkillOwner  = skillData.GetOwner();
 }
 private void ResetCurrentSkillSelection()
 {
     currentSelectedSkill       = "";
     currentSelectedSkillObject = null;
     currentSelectedSkillOwner  = null;
 }
    private void InitializeGame()
    {
        //step 1. Stub in portrait details and name for portrait.
        //in the meantime, just use these dummy images.
        GameObject curCharPanel = null;

        ScriptableSkills[] skillsConfig    = null;
        CharSelectPortrait curCharPortrait = null;

        SkillData[] curSkillsInPanel = null;
        GameObject  curHero;

        for (int i = 0; i < heroConfig.Count; i++)
        {
            partySelectPortraits[i].GetComponent <CharSelectPortrait>().SetPortraitImage(heroConfig[i].GetCharSprite());
            partySelectPortraits[i].GetComponent <CharSelectPortrait>().SetCharName(heroConfig[i].GetCharName());
            partySelectPortraits[i].GetComponent <CharSelectPortrait>().SetCharIndex(i);
            //while your here. INSTANTIATE the commandPanels too but setActive to false. We just want them in memory.
            //the hero panels need. Portrait, 3 text skill icons. and appropriate text to go along with those skiills.
            if (!curCharPanel)
            {
                //make sure the portrait from the commandPanel is aligned with the already existing partySelect portraits.
                //portraitPos_Y is STRICTLY for alignment!  it will guarantee that from tnow on all panels will be aligned with
                //the party select portraits!
                curCharPanel = Instantiate(charCommandPanel, carouselCommandPanel);
                allCommandPanels.Add(curCharPanel);
            }
            else
            {
                //curCharPanel will reference the LAST instantiated position.x, so we just do that + Screen.width to get optimal spacing for carousel
                Vector3 newPosition = new Vector3(curCharPanel.transform.position.x + Screen.width, curCharPanel.transform.position.y, 0);
                curCharPanel = Instantiate(charCommandPanel, newPosition, Quaternion.identity, carouselCommandPanel);
                allCommandPanels.Add(curCharPanel);
            }
            //instantiate a panel as a child of carousel. then were going to stub it in with data.
            curCharPortrait  = curCharPanel.GetComponentInChildren <CharSelectPortrait>();
            curSkillsInPanel = curCharPanel.GetComponentsInChildren <SkillData>();

            //YOU'RE GETTING AN ERROR CAUSE THIS IS HAPPENING WHILE ITS DIS-ACTIVE!!
            //YOU CAN'T GETCOMPONENT ON A DE-ACTIVATED COMPONENT.
            //THIS IS THE PORTRAIT IMAGE ON THE CMMD PANEL!!
            curCharPortrait.SetPortraitImage(heroConfig[i].GetCharSprite());
            curCharPortrait.SetCharName(heroConfig[i].GetCharName());
            curCharPortrait.SetCharIndex(i);

            //if error, check where hero is instantiated.
            curHero = Instantiate(heroConfig[i].GetHeroPrefab(), heroConfig[i].GetSpawnPosition(), Quaternion.identity);
            //curHero = Instantiate(heroConfig[i].GetHeroPrefab());
            CharStateManager charStatemanager = curHero.GetComponent <CharStateManager>();
            partySelectPortraits[i].GetComponent <CharSelectPortrait>().SetOwner(charStatemanager);
            //experimental line below
            curCharPortrait.SetOwner(charStatemanager);
            //experimental line above
            skillsConfig = heroConfig[i].GetCharSkills();
            for (int j = 0; j < skillsConfig.Length; j++)
            {
                curSkillsInPanel[j].SetSkillSprite(skillsConfig[j].GetSkillSprite());
                curSkillsInPanel[j].SetSkillName(skillsConfig[j].GetSkillName());
                curSkillsInPanel[j].SetSkillDescription(skillsConfig[j].GetSkillDescription());
                curSkillsInPanel[j].SetOwner(charStatemanager);
                //now add thisSKills data to our curreent heros stateManager
                charStatemanager.skillDictionary.Add(skillsConfig[j].GetSkillName(), skillsConfig[j].GetSkillObject());
            }

            //now that the UI is all setup. Instantiate this hero!

            //THE LINE OF CODE BELOW ONLY WORKS ONCE! we just want taht ONE target position on any screen once its instantiated.
            //what this allows me to do is that if the screen is wide, we'll still get the appropriate position to animate to
            targetPortraitPosition = targetPortraitPosition.HasValue == false
                                     ? curCharPortrait.transform.position
                                     : targetPortraitPosition.Value;
            curCharPanel.SetActive(false);
        }
    }
 public void InitState(CharStateManager thisCharacter)
 {
     Debug.Log("InitState IdleInactiveState");
     thisCharacter.idleInactiveRig.SetActive(true);
     thisCharacter.animator.Play(thisCharacter.CHAR_INACTIVE_IDLE);
 }
Example #26
0
 public void ExitState(CharStateManager thisCharacter)
 {
     thisCharacter.idleActiveRig.SetActive(false);
 }