Ejemplo n.º 1
0
        /// <summary>
        /// Mise à jour de l'effet
        /// </summary>
        /// <param name="status">Status du personnage affecté</param>
        /// <returns>Vérifie si l'état est fini</returns>
        public bool Effect(Status status)
        {
            switch (type)
            {
            case Condition.StateType.HEAL:
                status.AddHeal(value);
                break;

            case Condition.StateType.POISONED:
                status.AddDamage(value);
                break;

            case Condition.StateType.CURSED:
                status.maxLife = value;
                break;
            }
            if (time > 0)
            {
                time -= Time.deltaTime;
                if (type == Condition.StateType.CURSED)
                {
                    status.maxLife = 1;
                }

                return(time <= 0);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates influences.
        /// </summary>
        /// <param name="_influences">Influences.</param>
        public void UpdateStatusInfluences(InfluenceObject _influences)
        {
            if (_influences == null || _influences.Enabled == false)
            {
                return;
            }

            if (_influences.UseDamageInPercent)
            {
                Status.AddDamageInPercent(_influences.GetDamage());
            }
            else
            {
                Status.AddDamage(_influences.GetDamage());
            }

            if (_influences.UseStressInPercent)
            {
                Status.AddStressInPercent(_influences.GetStress());
            }
            else
            {
                Status.AddStress(_influences.GetStress());
            }

            if (_influences.UseDebilityInPercent)
            {
                Status.AddDebilityInPercent(_influences.GetDebility());
            }
            else
            {
                Status.AddDebility(_influences.GetDebility());
            }

            if (_influences.UseHungerInPercent)
            {
                Status.AddHungerInPercent(_influences.GetHunger());
            }
            else
            {
                Status.AddHunger(_influences.GetHunger());
            }

            if (_influences.UseThirstInPercent)
            {
                Status.AddThirstInPercent(_influences.GetThirst());
            }
            else
            {
                Status.AddThirst(_influences.GetThirst());
            }


            Status.AddAggressivity(_influences.Aggressivity);
            Status.AddAnxiety(_influences.Anxiety);
            Status.AddExperience(_influences.Experience);
            Status.AddNosiness(_influences.Nosiness);
        }
Ejemplo n.º 3
0
        //--------------------------------------------------
        public void FixedUpdate()
        {
            //TODO: obsolete
            if (Missions.Outpost.TargetReady())
            {
                Missions.Outpost.Target.FixedUpdate();
            }
            if (Missions.Escort.TargetReady())
            {
                Missions.Escort.Target.FixedUpdate();
            }
            if (Missions.Patrol.TargetReady())
            {
                Missions.Patrol.Target.FixedUpdate();
            }
            if (Interaction.TargetReady())
            {
                Interaction.FixedUpdate();
            }

            if (ActiveTarget != null && ActiveTarget.IsValid)
            {
                ActiveTarget.FixedUpdate();
            }

            if (Behaviour.BehaviourMode != null && Behaviour.BehaviourMode.Rule != null && Behaviour.BehaviourMode.Rule.Influences.Enabled)
            {
                Status.AddDamage(Behaviour.BehaviourMode.Rule.Influences.Damage);
                Status.AddStress(Behaviour.BehaviourMode.Rule.Influences.Stress);
                Status.AddDebility(Behaviour.BehaviourMode.Rule.Influences.Debility);
                Status.AddHunger(Behaviour.BehaviourMode.Rule.Influences.Hunger);
                Status.AddThirst(Behaviour.BehaviourMode.Rule.Influences.Thirst);
            }

            if (Environment.SurfaceHandler.ActiveSurface != null && Environment.SurfaceHandler.ActiveSurface.Influences.Enabled == true)
            {
                Status.AddDamage(Environment.SurfaceHandler.ActiveSurface.Influences.Damage);
                Status.AddStress(Environment.SurfaceHandler.ActiveSurface.Influences.Stress);
                Status.AddDebility(Environment.SurfaceHandler.ActiveSurface.Influences.Debility);
                Status.AddHunger(Environment.SurfaceHandler.ActiveSurface.Influences.Hunger);
                Status.AddThirst(Environment.SurfaceHandler.ActiveSurface.Influences.Thirst);
            }

            Status.FixedUpdate();

            if (Status.IsDead)
            {
                Behaviour.SetBehaviourModeByKey(Essentials.BehaviourModeDead);
                Status.RespawnRequest();
            }

            if (Status.IsRespawnTime)
            {
                Status.Respawn();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds or forwards the received damage.
        /// </summary>
        /// <param name="_damage">Damage.</param>
        /// <param name="_damage_direction">Damage direction.</param>
        /// <param name="_attacker_position">Attacker position.</param>
        /// <param name="_attacker">Attacker.</param>
        /// <param name="_force">Force.</param>
        public virtual void AddDamage(float _damage, Vector3 _damage_direction, Vector3 _damage_position, Transform _attacker, float _force = 0)
        {
            // use RootEntity instead of m_RootEntity to make sure that the root will be up-to-date
            if (IsChildEntity && Status.UseDamageTransfer)
            {
                RootEntity.AddDamage(_damage * Status.DamageTransferMultiplier, _damage_direction, _damage_position, _attacker, _force);
            }
            else
            {
                Status.AddDamage(_damage * Status.DamageTransferMultiplier);

                if (OnAddDamage != null)
                {
                    OnAddDamage(_damage * Status.DamageTransferMultiplier, _damage_direction, _damage_position, _attacker, _force);
                }
            }

            //ApplyImpact( _damage_direction, _force );
        }
Ejemplo n.º 5
0
        public void HandleCollision(Collision collision)
        {
            if (!Environment.CollisionHandler.Enabled || Status.IsDead)
            {
                return;
            }

            CollisionDataObject _impact = Environment.CollisionHandler.CheckCollision(collision);

            if (_impact != null)
            {
                Status.AddDamage(_impact.Influences.Damage);
                Status.AddStress(_impact.Influences.Stress);
                Status.AddDebility(_impact.Influences.Debility);
                Status.AddHunger(_impact.Influences.Hunger);
                Status.AddThirst(_impact.Influences.Thirst);

                if (_impact.BehaviourModeKey != "")
                {
                    Behaviour.SetBehaviourModeByKey(_impact.BehaviourModeKey);
                }
            }
        }