Example #1
0
    public override void affectObject()
    {
        AttachedEffectManager manager = getManager();

        if (manager == null || !manager.hasState(AttachedEffectManager.STATE_IGNITION))
        {
            return;
        }
        combust();
        endEffect();
    }
Example #2
0
    /**
     * Used to check the state of the object this is affecting and react accordingly.
     * e.g. an attached fire effect will check for wet state on the object and will be destroyed
     */
    private void compareState()
    {
        foreach (var state in getNegationStates())
        {
            if (!manager.hasState(state.Key))
            {
                continue;
            }
            if (manager.checkState(state.Key, state.Value))
            {
                continue;
            }

            endEffect(state.Key);
            return;
        }
    }
Example #3
0
    public override void processPrimaryHit(Item item, GameObject hit, Vector3 hitPoint, Vector3 direction)
    {
        hit.GetComponent <WorldObject>()?.takeDamage(damagePerSecond * Time.deltaTime);//TODO more damage if wet state and damage nearby wet objects
        if (lightning == null)
        {
            lightning = Instantiate(lightningBolt, hitPoint, Quaternion.identity);
        }
        AttachedEffectManager manager = hit.transform.root.GetComponent <AttachedEffectManager>();

        if (manager != null && manager.hasState(AttachedEffectManager.STATE_IGNITABLE))
        {
            manager.getAttachedStates()[AttachedEffectManager.STATE_IGNITABLE].First.endEffect(AttachedEffectManager.STATE_IGNITION);
        }
        lightning.StartPosition = item.transform.position;
        lightning.EndPosition   = hitPoint;
        lightning.Trigger();
        base.processPrimaryHit(item, hit, hitPoint, direction);
    }