public void TakeDamage(CharacterStateManager st, int amount)
 {
     if (st == this)
     {
         ((FloatVariable)runtimeStats.health.targetStat.value).Remove(amount);
     }
 }
Example #2
0
        private IEnumerator PerformDeathCleanup(CharacterStateManager states)
        {
            yield return(new WaitForEndOfFrame());

            states.anim.enabled     = false;
            states.animHook.enabled = false;
            states.enabled          = false;
        }
Example #3
0
        public override void Execute(CharacterStateManager charStates)
        {
            if (states == null)
            {
                Init(charStates);
            }

            playerStats.experience.targetStat.Add(((FloatVariable)experienceGain.targetStat.value).value);
        }
        private void OnTriggerEnter(Collider other)
        {
            CharacterStateManager states = other.transform.GetComponentInParent <CharacterStateManager>();

            if (states != null)
            {
                onHit?.Invoke(states);
            }
        }
        private void AwardExperience(CharacterStateManager charStates)
        {
            PlayerStateManager playerStates   = charStates as PlayerStateManager;
            PlayerStats        playerStats    = playerStates.runtimeStats as PlayerStats;
            EnemyStats         thisEnemyStats = this.runtimeStats as EnemyStats;

            playerStats.experience.targetStat.Add(((FloatVariable)thisEnemyStats.experienceReward.targetStat.value).value);
            hitCollider.onHit -= AwardExperience;
        }
Example #6
0
 public void ExecuteActions(CharacterStateManager states, StateActions[] l)
 {
     for (int i = 0; i < l.Length; i++)
     {
         if (l[i] != null)
         {
             l[i].Execute(states);
         }
     }
 }
Example #7
0
 public override void Execute(CharacterStateManager states)
 {
     if (boolVariable.value)
     {
         trueAction.Execute(states);
     }
     else
     {
         falseAction.Execute(states);
     }
 }
Example #8
0
        public override void Execute(CharacterStateManager states)
        {
            if (!hasInit)
            {
                InitStat();
            }

            float currentHealth = ((FloatVariable)states.runtimeStats.health.targetStat.value).value;
            float maxRegen      = (float)Convert.ToDecimal(states.runtimeStats.health.startingValue);
            float regenAmount   = ((FloatVariable)baseHealthRegen.targetStat.value).value;

            if (currentHealth < maxRegen)
            {
                states.runtimeStats.health.targetStat.Add(regenAmount);
            }
        }
Example #9
0
        public override void Execute(CharacterStateManager states)
        {
            for (int i = 0; i < states.ragdollRigids.Count; i++)
            {
                states.ragdollRigids[i].isKinematic = false;

                Collider col = states.ragdollColliders[i].GetComponent <Collider>();

                col.enabled   = true;
                col.isTrigger = false;
            }

            Collider characterCollider = states.rigidbody.gameObject.GetComponent <Collider>();

            characterCollider.enabled    = false;
            states.rigidbody.isKinematic = true;
        }
Example #10
0
        public void CheckTransitions(CharacterStateManager states)
        {
            for (int i = 0; i < transitions.Count; i++)
            {
                if (transitions[i].disable)
                {
                    continue;
                }

                if (transitions[i].condition.CheckCondition(states))
                {
                    if (transitions[i].targetState != null)
                    {
                        OnExit(states);
                        states.currentState = transitions[i].targetState;
                        states.currentState.OnEnter(states);
                    }
                    return;
                }
            }
        }
Example #11
0
        public override void Execute(CharacterStateManager charStates)
        {
            if (states == null)
            {
                states = charStates as PlayerStateManager;
            }

            switch (targetAxis)
            {
            case InputAxisType.X:
                value = states.mouseX;
                break;

            case InputAxisType.Y:
                value = states.mouseY;
                break;

            default:
                break;
            }
        }
        public override void Execute(CharacterStateManager states)
        {
            Rigidbody[] rigs = states.GetComponentsInChildren <Rigidbody>();

            for (int i = 0; i < rigs.Length; i++)
            {
                if (rigs[i] == states.rigidbody)
                {
                    continue;
                }

                states.ragdollRigids.Add(rigs[i]);
                rigs[i].isKinematic = true;

                Collider col = rigs[i].gameObject.GetComponent <Collider>();
                col.isTrigger = true;
                states.ragdollColliders.Add(col);

                col.enabled = false;
            }
        }
Example #13
0
 public override void Execute(CharacterStateManager states)
 {
     states.anim.SetBool("isUnarmed", states.isUnarmed);
     states.anim.SetBool("isTwoHanded", states.isTwoHanded);
     states.anim.SetBool("isLockedOn", states.isLockedOn);
 }
Example #14
0
 public void PerformDeathCleanupWrapper(CharacterStateManager states)
 {
     StartCoroutine(PerformDeathCleanup(states));
 }
 public void Init(CharacterStateManager st)
 {
     anim         = st.anim;
     charStates   = st;
     playerStates = st as PlayerStateManager;
 }
Example #16
0
 public void Tick(CharacterStateManager states)
 {
     ExecuteActions(states, onUpdate);
     CheckTransitions(states);
 }
Example #17
0
 public void OnExit(CharacterStateManager states)
 {
     ExecuteActions(states, onExit);
 }
Example #18
0
 public abstract bool CheckCondition(CharacterStateManager states);
 public override void Execute(CharacterStateManager states)
 {
     states.anim.applyRootMotion = status;
 }
Example #20
0
 private void Init(CharacterStateManager charStates)
 {
     states      = charStates as PlayerStateManager;
     playerStats = states.runtimeStats as PlayerStats;
     ((FloatVariable)experienceGain.targetStat.value).Set(experienceGain.startingValue);
 }
 public abstract void Execute(CharacterStateManager characterStates);
        public override bool CheckCondition(CharacterStateManager states)
        {
            bool returnValue = !states.anim.GetBool(targetBool);

            return(returnValue);
        }
Example #23
0
        public override void Execute(CharacterStateManager states)
        {
            ScriptableHelpers sh = gameManager.value.GetComponent <ScriptableHelpers>();

            sh.PerformDeathCleanupWrapper(states);
        }