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

        if (manager == null || !manager.hasState(AttachedEffectManager.STATE_IGNITION))
        {
            return;
        }
        combust();
        endEffect();
    }
 public void startEffect()
 {
     manager = getManager();
     compareState();
     if (effectEnded)
     {
         return;
     }
     started = true;
     applyStates();
 }
Beispiel #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);
    }
 protected AttachedEffectManager getManager()
 {
     manager = transform.root.GetComponent <AttachedEffectManager>();
     return(manager == null?transform.root.gameObject.AddComponent <AttachedEffectManager>() : manager);
 }