Exemple #1
0
 public SlotNameHashCommand(ActorSlot slot, uint newValue)
 {
     this.mSlot   = slot;
     this.mOldVal = slot.mSlotNameHash;
     this.mNewVal = newValue;
     this.mLabel  = "Set Slot Name Hash of Actor Slot";
 }
Exemple #2
0
 public RemoveItemAtCommand(ActorSlotList asl, int index)
 {
     this.mSlotList = asl;
     this.mSlot     = asl[index];
     this.mIndex    = index;
     this.mLabel    = "Remove Actor Slot from Slot Builder";
 }
Exemple #3
0
 public InsertNewItemCommand(ActorSlotList asl, int index)
 {
     this.mSlotList = asl;
     this.mSlot     = new ActorSlot(asl.mSlotBuilder);
     this.mIndex    = index;
     this.mLabel    = "Insert New Actor Slot into Slot Builder";
 }
Exemple #4
0
 public ChainIDCommand(ActorSlot slot, uint newValue)
 {
     this.mSlot   = slot;
     this.mOldVal = slot.mChainID;
     this.mNewVal = newValue;
     this.mLabel  = "Set Chain ID of Actor Slot";
 }
    public void SpawnDamage(int Damage, ActorSlot actor, bool Healing = false)
    {
        //spawn
        //set parent
        //set local transform
        GameObject go = Instantiate <GameObject>(DamagePopupPrefab, actor.transform);

        RectTransform rect = go.GetComponent <RectTransform>();

        if (actor.IsAI)
        {
            go.transform.parent = actor.HP.transform.parent;
            rect.localPosition  = new Vector3(10, 35, 0);
        }
        else
        {
            rect.localPosition = new Vector3(260, 0, 0);
        }
        TextMeshProUGUI text = go.GetComponent <TextMeshProUGUI>();

        text.text = Damage.ToString();
        if (Healing || Damage > 0)
        {
            text.text  = "+ " + text.text;
            text.color = Color.green;
        }
        float curHP  = actor.Actor.CurStats.HP;
        float result = curHP / actor.Actor.MaxStats.HP;

        actor.HPForeground.fillAmount = result;
        actor.HP.text = actor.Actor.CurStats.HP.ToString();

        DeathCheck(actor);
        //deduce if dead
    }
    public void SlideActor(ActorSlot actor)
    {
        Debug.Log("Slide actor");
        CharacterSprite charSprite = CutsceneManager.Instance.rightCharacter.GetComponent <CharacterSprite>();

        charSprite.Face.enabled   = true;
        charSprite.Outfit.enabled = true;
        charSprite.Face.sprite    = actor.Actor.BattleFacePath.Get();
        charSprite.Outfit.sprite  = actor.Actor.BattleOutfitPath.Get();

        Transform dest       = CutsceneManager.Instance.RightSpot;
        Image     rightImage = CutsceneManager.Instance.rightCharacter;

        Vector3 _beginPoint = new Vector3(dest.position.x + 100, rightImage.transform.position.y, rightImage.transform.position.z);
        Vector3 _endPoint   = new Vector3(CutsceneManager.Instance.RightSpot.position.x, _beginPoint.y, _beginPoint.z);

        Image _face   = charSprite.Face;
        Image _outfit = charSprite.Outfit;

        rightImage.transform.position = _beginPoint;
        LeanTween.move(rightImage.gameObject, _endPoint, SpriteTime);

        MovementNode.ColorChange(_outfit.gameObject, new Color(0.7f, 0.7f, 0.7f, 1), new Color(1, 1, 1, 1), SpriteTime);
        MovementNode.ColorChange(_face.gameObject, new Color(0.7f, 0.7f, 0.7f, 1), new Color(1, 1, 1, 1), SpriteTime);
    }
    public IEnumerator SlightDelay()
    {
        yield return(new WaitForSeconds(0.01f));

        CurrentActor = Actors[0];
        if (!DelayedStart)
        {
            StartActor();
        }
    }
    public IEnumerator DelayedSpawn(float DestructTimer, int popupText, ActorSlot Defender, bool Healing = false)
    {
        yield return(new WaitForSeconds(DestructTimer));

        SpawnDamage(popupText, Defender, Healing);
        if (Defender.IsAI && Defender.Actor.CurStats.HP > 0)
        {
            Defender.GetComponent <Animator>().SetTrigger("Damage");
        }
    }
 private void SetStats(ActorSlot actor, bool SecondStat = false)
 {
     SetSingleLine(HP, actor.Actor.MaxStats.HP, SecondStat);
     SetSingleLine(MP, actor.Actor.MaxStats.MP, SecondStat);
     SetSingleLine(Muscle, actor.Actor.MaxStats.Muscle, SecondStat);
     SetSingleLine(Vigor, actor.Actor.MaxStats.Vigor, SecondStat);
     SetSingleLine(Will, actor.Actor.MaxStats.Will, SecondStat);
     SetSingleLine(Instinct, actor.Actor.MaxStats.Instinct, SecondStat);
     SetSingleLine(Agility, actor.Actor.MaxStats.Agility, SecondStat);
 }
 public void NextActor()
 {
     ActorCounter++;
     if (ActorCounter >= Actors.Count)
     {
         ActorCounter = 0;
         StartCoroutine(DelayTurn());
     }
     else
     {
         CurrentActor = Actors[ActorCounter];
     }
     StartCoroutine(DelayActor());
 }
    public void SkillCheck(ActorSlot actor)
    {
        List <Skills> skills = actor.Actor.Skills;

        //Forloop check for skills that 1 are <= current level, but havent been marked as learned
        for (int i = 0; i < actor.Actor.Skills.Count; i++)
        {
            if (skills[i].LevelLearned <= actor.Actor.Lvl && !skills[i].Learned)
            {
                //mark as learned && summon
                skills[i].Learned = true;
                GameObject go = Instantiate <GameObject>(skillDropPrefab, gameObject.transform);
                go.transform.localPosition = new Vector3(125.86f, -142f + Multiplier * -34.56f);
                Multiplier++;
                QuickScale(go);
                skillDrops.Add(go);
                go.GetComponent <SkillDrop>().Name.text = skills[i].Name;
            }
        }
    }
    public void DeathCheck(ActorSlot actor)
    {
        if (actor.Actor.CurStats.HP <= 0)
        {
            actor.Dead = true;
            if (actor.IsAI)
            {
                //Add EXP to end
                //Remove from list
                Enemies.Remove(actor);
                Actors.Remove(actor);
                EXPPayout += actor.Actor.EXP;

                StartCoroutine(DestroyEnemy(actor.gameObject));
            }
            else
            {
            }
        }
    }
    public void SkillProcess(GameObject target, GameObject user, Skills.HitType hitType)
    {
        BattleManager bm = GameManager.Instance.BattleManager;

        bm.IsHealing = false;
        ActorSlot actor = user.GetComponent <ActorSlot>();

        if (!actor.IsAI)
        {
            actor.Actor.CurStats.MP -= Cost;
            float curMP  = actor.Actor.CurStats.MP;
            float result = curMP / actor.Actor.MaxStats.MP;
            actor.MPForeground.fillAmount = result;
            actor.MP.text = curMP.ToString();
        }


        int       tempAttack  = 0;
        int       tempDefense = 0;
        int       modifier;
        int       popupText;
        ActorSlot Attacker = user.GetComponent <ActorSlot>();
        ActorSlot Defender = target.GetComponent <ActorSlot>();
        string    readThis = "";

        if (hitType == Skills.HitType.Physical || hitType == Skills.HitType.Magical)
        {
            tempDefense = Defender.Actor.CurStats.Will;
            switch (hitType)
            {
            case Skills.HitType.Physical:
                tempAttack = Attacker.Actor.CurStats.Muscle;
                break;

            case Skills.HitType.Magical:
                tempAttack = Attacker.Actor.CurStats.Vigor;
                break;
            }
            modifier = BaseDamage * tempAttack - tempDefense; //This is where we'd plug elements in
            if (modifier < 0)
            {
                modifier = 0;
            }

            //this is where we would calculate magic affecting the damage, here it would not matter if
            //it was below 0, since magic damage can turn into negative
            // Debug.Log(Name + "HP Before using "  + "  " + Defender.Actor.CurStats.HP);
            Defender.Actor.CurStats.HP -= modifier;
            if (Defender.Actor.CurStats.HP < 0)
            {
                Defender.Actor.CurStats.HP = 0;
            }
            if (Defender.Actor.CurStats.HP > Defender.Actor.MaxStats.HP)
            {
                Defender.Actor.CurStats.HP = Defender.Actor.MaxStats.HP;
            }

            popupText = modifier * -1;

            if (UAP_AccessibilityManager.IsEnabled())
            {
                bm.StartSpawn(0f, popupText, Defender);
            }
            else
            {
                bm.StartSpawn(DestructTimer, popupText, Defender);
                if (!actor.IsAI)
                {
                    if (Name == "Attack")
                    {
                        SFXManager.Main.Play(actor.Actor.AttackVoices.Get());
                    }
                    else
                    {
                        SFXManager.Main.Play(actor.Actor.DefaultSpecialVoices.Get());
                    }
                }
            }


            readThis = string.Format("{0} hits {1} for {2} damage.", user.GetComponent <ActorSlot>().Actor.Name, Defender.Actor.Name, modifier.ToString());
            //UAP_AccessibilityManager.Say()
        }
        else
        {
            switch (hitType)
            {
            case Skills.HitType.Heal:
                bm.IsHealing = true;
                tempAttack   = Attacker.Actor.CurStats.Vigor;
                modifier     = BaseDamage * tempAttack;
                popupText    = Defender.Actor.CurStats.HP;
                Defender.Actor.CurStats.HP += modifier;
                if (Defender.Actor.CurStats.HP > Defender.Actor.MaxStats.HP)
                {
                    Defender.Actor.CurStats.HP = Defender.Actor.MaxStats.HP;
                }
                popupText = Defender.Actor.CurStats.HP - popupText;
                if (UAP_AccessibilityManager.IsEnabled())
                {
                    bm.StartSpawn(0f, popupText, Defender);
                }
                else
                {
                    if (!actor.IsAI)
                    {
                        SFXManager.Main.Play(actor.Actor.HealingVoices.Get());
                    }
                    bm.StartSpawn(DestructTimer, popupText, Defender);
                }
                readThis = string.Format("{0} heals {1} for {2} health.", user.GetComponent <ActorSlot>().Actor.Name, Defender.Actor.Name, modifier.ToString());
                break;

            case Skills.HitType.Status:     //not touched in demo
                break;
            }
        }
        UAP_AccessibilityManager.Say(readThis, false);
    }
    private IEnumerator LevelProcess(ActorSlot actor, int index)
    {
        Debug.Log(index);
        PauseProcessing = true;

        GameManager.Instance.BattleManager.SlideActor(actor);
        int  expDrain = GameManager.Instance.BattleManager.EXPPayout;
        bool Leveled  = false;

        actor.Actor.EXP += expDrain;
        if (actor.Actor.EXP >= actor.Actor.EXPToLevel())
        {
            Leveled = true;
        }
        QuickScale(LvlNumber.transform.parent.gameObject);
        QuickScale(ExpBar.gameObject);
        QuickScale(ExpBG.gameObject);
        QuickScale(LvlNumber.gameObject);
        LvlNumber.text = actor.Actor.Lvl.ToString();
        float time    = 4;
        float curTime = 0;

        if (Leveled)
        {
            LeanTween.value(ExpBar.gameObject, (float x) => ExpBar.fillAmount = x, 0, 1, 4);
        }
        else
        {
            //time not = to 4 but idfc atm and won't bother setting this up completely as things currently stand
        }

        do
        {
            curTime += Time.deltaTime;

            if (curTime / time < .86)
            {
                SFXManager.Main.Play(EXPSound);
            }
            yield return(null);
        } while (curTime < time);
        if (Leveled)
        {
            SFXManager.Main.Play(LevelUpSound);

            //tween in Statpanel
            QuickScale(StatPanel);
            //tween each stat base
            QuickScale(HP.gameObject);
            QuickScale(MP.gameObject);
            QuickScale(Muscle.gameObject);
            QuickScale(Vigor.gameObject);
            QuickScale(Will.gameObject);
            QuickScale(Instinct.gameObject);
            QuickScale(Agility.gameObject);
            SetStats(actor);

            yield return(new WaitForSeconds(1));

            //tween in -> and newLvl
            QuickScale(Line);
            QuickScale(NewLvl.gameObject);
            //Add lvl and run lvl function on actor
            actor.Actor.LevelUp();
            NewLvl.text = actor.Actor.Lvl.ToString();
            yield return(new WaitForSeconds(1));

            //Tween in each new stat
            ShowArrow();
            SetStats(actor, true);
            yield return(new WaitForSeconds(2));

            //drop skills
            SkillCheck(actor);
            //wait x time
            yield return(new WaitForSeconds(2 * Multiplier));

            foreach (GameObject go in skillDrops)
            {
                go.GetComponent <SkillDrop>().SelfDestruct();
            }
            skillDrops.Clear();
            Multiplier = 0;
        }
        DisableLine(HP);
        DisableLine(MP);
        DisableLine(Muscle);
        DisableLine(Vigor);
        DisableLine(Will);
        DisableLine(Instinct);
        DisableLine(Agility);
        StatPanel.SetActive(false);

        index++;
        if (index < GameManager.Instance.BattleManager.Party.Count)
        {
            StartCoroutine(LevelProcess(GameManager.Instance.BattleManager.Party[index], index));
        }
        else
        {
        }
    }
 public void NextTurn()
 {
     CurrentActor = Actors[ActorCounter];
     TurnCounter++;
     StartOfTurn.Invoke();
 }
 public void StartSpawn(float DestructTimer, int popupText, ActorSlot Defender, bool Healing = false)
 {
     StartCoroutine(DelayedSpawn(DestructTimer, popupText, Defender, Healing));
 }
Exemple #17
0
 public AddNewItemCommand(ActorSlotList asl)
 {
     this.mSlotList = asl;
     this.mSlot     = new ActorSlot(asl.mSlotBuilder);
     this.mLabel    = "Add New Actor Slot to Slot Builder";
 }
    public void SkillProcess(GameObject target, GameObject user, Skills.HitType hitType)
    {
        BattleManager bm    = GameManager.Instance.BattleManager;
        ActorSlot     actor = user.GetComponent <ActorSlot>();

        if (!actor.IsAI)
        {
            actor.Actor.CurStats.MP -= Cost;
            float curMP  = actor.Actor.CurStats.MP;
            float result = curMP / actor.Actor.MaxStats.MP;
            actor.MPForeground.fillAmount = result;
            actor.MP.text = curMP.ToString();
        }


        int       tempAttack  = 0;
        int       tempDefense = 0;
        int       modifier;
        int       popupText;
        ActorSlot Attacker = user.GetComponent <ActorSlot>();
        ActorSlot Defender = target.GetComponent <ActorSlot>();

        if (hitType == Skills.HitType.Physical || hitType == Skills.HitType.Magical)
        {
            tempDefense = Defender.Actor.CurStats.Will;
            switch (hitType)
            {
            case Skills.HitType.Physical:
                tempAttack = Attacker.Actor.CurStats.Muscle;
                break;

            case Skills.HitType.Magical:
                tempAttack = Attacker.Actor.CurStats.Vigor;
                break;
            }
            modifier = BaseDamage * tempAttack - tempDefense; //This is where we'd plug elements in
            if (modifier < 0)
            {
                modifier = 0;
            }

            //this is where we would calculate magic affecting the damage, here it would not matter if
            //it was below 0, since magic damage can turn into negative
            // Debug.Log(Name + "HP Before using "  + "  " + Defender.Actor.CurStats.HP);
            Defender.Actor.CurStats.HP -= modifier;
            if (Defender.Actor.CurStats.HP < 0)
            {
                Defender.Actor.CurStats.HP = 0;
            }
            if (Defender.Actor.CurStats.HP > Defender.Actor.MaxStats.HP)
            {
                Defender.Actor.CurStats.HP = Defender.Actor.MaxStats.HP;
            }

            popupText = modifier * -1;
            bm.StartSpawn(DestructTimer, popupText, Defender);
        }
        else
        {
            switch (hitType)
            {
            case Skills.HitType.Heal:
                tempAttack = Attacker.Actor.CurStats.Vigor;
                modifier   = BaseDamage * tempAttack;
                popupText  = Defender.Actor.CurStats.HP;
                Defender.Actor.CurStats.HP += modifier;
                if (Defender.Actor.CurStats.HP > Defender.Actor.MaxStats.HP)
                {
                    Defender.Actor.CurStats.HP = Defender.Actor.MaxStats.HP;
                }
                popupText = Defender.Actor.CurStats.HP - popupText;
                bm.StartSpawn(DestructTimer, popupText, Defender, true);
                break;

            case Skills.HitType.Status:     //not touched in demo
                break;
            }
        }
    }