コード例 #1
0
ファイル: GameResourceDisplay.cs プロジェクト: Alarack/Blazer
    private void OnStatChanged(EventData data)
    {
        Entity target = data.GetMonoBehaviour("Target") as Entity;

        if (target != player)
        {
            return;
        }

        Constants.BaseStatType stat = (Constants.BaseStatType)data.GetInt("Stat");

        if (stat != Constants.BaseStatType.Money && stat != Constants.BaseStatType.Keys)
        {
            return;
        }


        switch (stat)
        {
        case Constants.BaseStatType.Money:
            moneyText.text = "Money: " + "$" + player.stats.GetStatModifiedValue(Constants.BaseStatType.Money).ToString();
            break;

        case Constants.BaseStatType.Keys:
            keysText.text = "Keys: " + player.stats.GetStatModifiedValue(Constants.BaseStatType.Keys).ToString();
            break;
        }
    }
コード例 #2
0
ファイル: RecoveryStatChanged.cs プロジェクト: Alarack/Blazer
    private void OnStatChanged(EventData data)
    {
        Constants.BaseStatType stat = (Constants.BaseStatType)data.GetInt("Stat");
        float  value  = data.GetFloat("Value");
        Entity target = data.GetMonoBehaviour("Target") as Entity;
        Entity cause  = data.GetMonoBehaviour("Cause") as Entity;

        if (stat != this.stat)
        {
            return;
        }

        if (sourceWasChanged && target != parentAbility.source)
        {
            return;
        }

        if (sourceCausedChange && cause != parentAbility.source)
        {
            return;
        }

        if (gained && value < 0)
        {
            return;
        }

        if (!gained && value > 0)
        {
            return;
        }

        CheckReady();
    }
コード例 #3
0
ファイル: SpecialAbility.cs プロジェクト: Alarack/BlazerV2
    private void OnDamageDealt(EventData data)
    {
        Constants.BaseStatType stat = (Constants.BaseStatType)data.GetInt("Stat");
        Entity target = data.GetMonoBehaviour("Target") as Entity;
        Entity cause  = data.GetMonoBehaviour("Cause") as Entity;
        float  value  = data.GetFloat("Value");

        //Debug.Log(target.gameObject + " has been damaged by " + cause.gameObject);

        if (cause != source)
        {
            return;
        }

        if (stat != Constants.BaseStatType.Health)
        {
            return;
        }

        if (value > 0)
        {
            return;
        }


        //Debug.Log(abilityName + " is activating on damage dealt");
        AddTarget(target);


        Activate();
    }
コード例 #4
0
ファイル: EntityMovement.cs プロジェクト: Alarack/BlazerV2
    protected virtual void OnStatChanged(EventData data)
    {
        Constants.BaseStatType stat = (Constants.BaseStatType)data.GetInt("Stat");
        Entity target = data.GetMonoBehaviour("Target") as Entity;

        //Debug.Log("Event Recieved: " + target.gameObject.name + " ::: " + stat);

        if (target != owner)
        {
            //Debug.Log(target.gameObject.name + " does not match " + owner.gameObject.name);

            return;
        }


        switch (stat)
        {
        case Constants.BaseStatType.MoveSpeed:
            //Debug.Log("MoveSpeed Event Recieved");
            maxSpeed = owner.stats.GetStatModifiedValue(Constants.BaseStatType.MoveSpeed);
            break;

        case Constants.BaseStatType.JumpForce:
            jumpForce = owner.stats.GetStatModifiedValue(Constants.BaseStatType.JumpForce);
            break;
        }
    }
コード例 #5
0
ファイル: SpecialAbility.cs プロジェクト: Alarack/BlazerV2
    private void OnDamageTaken(EventData data)
    {
        Constants.BaseStatType stat = (Constants.BaseStatType)data.GetInt("Stat");
        //Entity target = data.GetMonoBehaviour("Target") as Entity;
        Entity cause  = data.GetMonoBehaviour("Cause") as Entity;
        Entity target = data.GetMonoBehaviour("Target") as Entity;
        float  value  = data.GetFloat("Value");

        if (cause == source)
        {
            return;
        }

        if (target != source)
        {
            return;
        }

        if (stat != Constants.BaseStatType.Health)
        {
            return;
        }

        if (value > 0)
        {
            return;
        }


        //Debug.Log("Activating an on-damage-taken ability");
        Activate();
    }
コード例 #6
0
    public static void RemoveTrackedStatMod(Entity targetOfChange, Constants.BaseStatType stat, StatCollection.StatModifer mod)
    {
        targetOfChange.stats.RemoveTrackedMod(stat, mod);

        Debug.Log("Removing a mod: " + stat + " value of " + mod.value);

        combatManager.SendStatChangeEvent(null, targetOfChange, stat, mod.value);
    }
コード例 #7
0
    private void SendStatChangeEvent(Entity causeOfChagne, Entity targetOfChagnge, Constants.BaseStatType stat, float value)
    {
        EventData data = new EventData();

        data.AddMonoBehaviour("Cause", causeOfChagne);
        data.AddMonoBehaviour("Target", targetOfChagnge);
        data.AddInt("Stat", (int)stat);
        data.AddFloat("Value", value);

        //Debug.Log("Event Sent: " + stat.ToString() + " :: " + value);
        EventGrid.EventManager.SendEvent(Constants.GameEvent.StatChanged, data);
    }
コード例 #8
0
    private BaseStat GetStat(Constants.BaseStatType statType)
    {
        for (int i = 0; i < baseStats.Count; i++)
        {
            if (baseStats[i].statType == statType)
            {
                return(baseStats[i]);
            }
        }

        return(null);
    }
コード例 #9
0
    public void InitializeDurationalStatChange(Constants.BaseStatType targetStat, StatCollection.StatModificationType modType, float statAdjValue)
    {
        this.targetStat   = targetStat;
        this.modType      = modType;
        this.statAdjValue = statAdjValue;


        if (StatusManager.IsTargetAlreadyAffected(targetEntity, this, sourceAbility) == false)
        {
            CreateStatMod();
        }
    }
コード例 #10
0
    public float GetStatMultipler(Constants.BaseStatType statType)
    {
        for (int i = 0; i < baseStats.Count; i++)
        {
            if (baseStats[i].statType == statType)
            {
                return(baseStats[i].GetTotalMultiplier());
            }
        }

        return(1f);
    }
コード例 #11
0
    public float GetStatMaxValue(Constants.BaseStatType statType)
    {
        for (int i = 0; i < baseStats.Count; i++)
        {
            if (baseStats[i].statType == statType)
            {
                return(baseStats[i].MaxValue);
            }
        }

        return(0);
    }
コード例 #12
0
ファイル: EffectStatus.cs プロジェクト: Alarack/Blazer
    public EffectStatus(EffectStatus effectStatus)
    {
        effectName       = effectStatus.effectName;
        riderTarget      = effectStatus.riderTarget;
        effectType       = effectStatus.effectType;
        deliveryMethod   = effectStatus.deliveryMethod;
        animationTrigger = effectStatus.animationTrigger;

        applyToSpecificTarget = effectStatus.applyToSpecificTarget;
        targetIndex           = effectStatus.targetIndex;
        riders = effectStatus.CloneRiders();

        scaleFromBaseDamage = effectStatus.scaleFromBaseDamage;
        percentOfBaseDamage = effectStatus.percentOfBaseDamage;
        damagePerInterval   = effectStatus.damagePerInterval;

        statusType  = effectStatus.statusType;
        stackMethod = effectStatus.stackMethod;
        maxStack    = effectStatus.maxStack;
        duration    = effectStatus.duration;
        interval    = effectStatus.interval;

        onCompleteEffectName = effectStatus.onCompleteEffectName;

        affectMoveType  = effectStatus.affectMoveType;
        affectMoveValue = effectStatus.affectMoveValue;
        knocbackAngle   = effectStatus.knocbackAngle;

        statType            = effectStatus.statType;
        statAdjustmentValue = effectStatus.statAdjustmentValue;
        modType             = effectStatus.modType;



        switch (deliveryMethod)
        {
        case Constants.EffectDeliveryMethod.Melee:
            meleeDelivery.prefabName = effectStatus.meleeDelivery.prefabName;
            meleeDelivery.layerMask  = effectStatus.meleeDelivery.layerMask;
            break;

        case Constants.EffectDeliveryMethod.Projectile:
            projectileDelivery.prefabName = effectStatus.projectileDelivery.prefabName;
            projectileDelivery.layerMask  = effectStatus.projectileDelivery.layerMask;
            break;
        }
    }
コード例 #13
0
ファイル: HealthDeathManager.cs プロジェクト: Alarack/Blazer
    protected void OnStatChanged(EventData data) {
        Constants.BaseStatType stat = (Constants.BaseStatType)data.GetInt("Stat");
        Entity target = data.GetMonoBehaviour("Target") as Entity;
        Entity cause = data.GetMonoBehaviour("Cause") as Entity;

        if (target != owner)
            return;

        if(stat == Constants.BaseStatType.Health) {
            //Debug.Log(owner.stats.GetStatModifiedValue(Constants.BaseStatType.Health) + " is the health of " + owner.gameObject.name);

            float currentHealth = owner.stats.GetStatModifiedValue(Constants.BaseStatType.Health);
            float maxHealth = owner.stats.GetStatMaxValue(Constants.BaseStatType.Health);

            UpdateHealthBar(currentHealth, maxHealth);

            if (currentHealth <= 0f) {
                if(!cheat)
                    Die(cause);
            }
        }

    }
コード例 #14
0
    public static void ApplyUntrackedStatMod(Entity causeOfChagne, Entity targetOfChagnge, Constants.BaseStatType stat, float value, StatCollection.StatModificationType modType = StatCollection.StatModificationType.Additive)
    {
        float sendableValue = 0f;

        if (stat == Constants.BaseStatType.Health)
        {
            float armor = targetOfChagnge.stats.GetStatModifiedValue(Constants.BaseStatType.Armor);
            //Debug.Log(armor + " is the armor of " + targetOfChagnge.entityName);
            sendableValue = Mathf.Clamp(value + armor, value, 0f);

            float damageReduction = targetOfChagnge.stats.GetStatModifiedValue(Constants.BaseStatType.DamageReduction);

            float convertedDR = Mathf.Clamp(Mathf.Abs(damageReduction - 1f), 0f, 1f);

            sendableValue *= convertedDR;
        }
        else
        {
            sendableValue = value;
        }


        targetOfChagnge.stats.ApplyUntrackedMod(stat, sendableValue, causeOfChagne, modType);

        combatManager.SendStatChangeEvent(causeOfChagne, targetOfChagnge, stat, sendableValue);

        if (stat == Constants.BaseStatType.Health && value < 0f)
        {
            VisualEffectManager.MakeFloatingText(Mathf.Abs(sendableValue).ToString(), targetOfChagnge.transform.position);
        }
    }
コード例 #15
0
    public void RemoveTrackedMod(Constants.BaseStatType statType, StatModifer mod)
    {
        BaseStat targetStat = GetStat(statType);

        targetStat.RemoveModifier(mod);
    }
コード例 #16
0
    public void ApplyTrackedMod(Constants.BaseStatType statType, StatModifer mod)
    {
        BaseStat targetStat = GetStat(statType);

        targetStat.ModifyStat(mod);
    }
コード例 #17
0
    public void ApplyUntrackedMod(Constants.BaseStatType statType, float value, Entity source, StatModificationType modType = StatModificationType.Additive)
    {
        BaseStat targetStat = GetStat(statType);

        targetStat.ModifyStat(value, modType);
    }
コード例 #18
0
 public BaseStat(Constants.BaseStatType statType, float baseValue, float maxValue)
 {
     this.statType = statType;
     BaseValue     = baseValue;
     MaxValue      = maxValue;
 }
コード例 #19
0
    public static void ApplyTrackedStatMod(Entity causeOfChagne, Entity targetOfChange, Constants.BaseStatType stat, StatCollection.StatModifer mod)
    {
        targetOfChange.stats.ApplyTrackedMod(stat, mod);

        combatManager.SendStatChangeEvent(causeOfChagne, targetOfChange, stat, mod.value);

        if (stat == Constants.BaseStatType.Health && mod.value < 0f)
        {
            VisualEffectManager.MakeFloatingText(Mathf.Abs(mod.value).ToString(), targetOfChange.transform.position);
        }
    }
コード例 #20
0
 public static void AddStaticPlayerStatAdjustment(Constants.BaseStatType targetStat, float value)
 {
     ApplyUntrackedStatMod(null, GameManager.GetPlayer(), targetStat, value);
 }