예제 #1
0
    public void CalculateEffect(GameObject aDamager, DynamicEffect aDamage)
    {
        switch (aDamage.TypeOfEffect)
        {
            case EffectType.loss:
                if (m_Health > 0)
                {
                    m_Health -= aDamage.Value;
                }
                break;
            case EffectType.gain:
                if (m_Health > 0)
                {
                    m_Health += aDamage.Value;
                }
               
                break;
        }

		if (m_Health > 0)
		{
			return;
		}

		m_Health = 0;
		gameObject.SetActive(false);
    }
예제 #2
0
    public void CalculateEffect(GameObject aDamager, DynamicEffect aDamage)
    {
        switch (aDamage.TypeOfEffect)
        {
        case EffectType.loss:
            if (m_Health > 0)
            {
                m_Health -= aDamage.Value;
            }
            break;

        case EffectType.gain:
            if (m_Health > 0)
            {
                m_Health += aDamage.Value;
            }

            break;
        }

        if (m_Health > 0)
        {
            return;
        }

        m_Health = 0;
        gameObject.SetActive(false);
    }
예제 #3
0
 public void AddEffectsForPlayer(PlayerObject source, PlayerObject target, List<Effect> effect)
 {
     foreach (Effect e in effect)
     {
         DynamicEffect de = new DynamicEffect(e, source, target);
         _effectDictionary[target].Add(de);
     }
 }
예제 #4
0
 private bool RemoveCheck(DynamicEffect e)
 {
     if (e._currentDuration < 0)
     {
         //REMOVE THIS SPELL
         return true;
     }
     //DONT REMOVE THIS SPELL
     return false;
 }
예제 #5
0
    private void ResolveEffect(PlayerObject player, DynamicEffect effect)
    {
        // Instant
        if (effect._dynamicType == DynamicEffectType.instant || effect._dynamicType == DynamicEffectType.buff)
        {
            // Recalculation of the amount for blocking
            if (effect._effectType == EffectType.life)
            {
                if (effect._amount < 0)
                {
                    PlayerState playerState = player._playerPrefab.GetComponent<PlayerState>();

                    if (playerState._forwardBlock > 0)
                    {
                        Vector3 heading = effect._target._playerPrefab.transform.position - effect._source._playerPrefab.transform.position;
                        float dot = Vector3.Dot(heading, effect._target._playerPrefab.transform.forward);

                        if (dot < 0.0f)
                        {
                            effect._amount = effect._amount * (1 - playerState._forwardBlock);

                            Debug.Log("in front");
                        }
                    }
                }
            }

            // RPC call (Dynamic effect isn't a supported type, so you have to send the members)
            _nv.RPC("SC_DoEffect", RPCMode.All, player._networkPlayer, (int)effect._effectType, effect._amount, effect._percentage);

            effect._isResolved = true;
            return; //Nothing more should happen
        }
        // Frequently effect
        else if (effect._dynamicType == DynamicEffectType.frequent)
        {
            if (effect._currentDuration < (effect._frequentDuration - effect._frequency))
            {
                // RPC call (Dynamic effect isn't a supported type, so you have to send the members)
                _nv.RPC("SC_DoEffect", RPCMode.All, player._networkPlayer, (int)effect._effectType, effect._amount, effect._percentage);

                if (effect._currentDuration <= 0.0f)
                {
                    effect._isResolved = true;
                }
                else
                {
                    // Change the duration for the next tick
                    effect._frequentDuration = effect._frequentDuration - effect._frequency;
                }
            }

            return; //Nothing more should happen
        }
    }