public override void Run(GoapAgent agent)
 {
     if (statusEffectHost == null)
     {
         statusEffectHost = agent.GetComponent <StatusEffectHost>();
     }
     agent.state["paralyzed"] = IsParalyzed();
 }
Beispiel #2
0
    public StatusEffectHost GetNearestTargetToPoint(Vector3 point)
    {
        float            smallestDistance = Mathf.Infinity;
        StatusEffectHost closestTarget    = null;

        foreach (var monster in Monster.monsters)
        {
            var distance = Vector3.Distance(monster.transform.position, point);
            if (distance < smallestDistance && distance < 20f)
            {
                smallestDistance = distance;
                closestTarget    = monster.GetComponent <StatusEffectHost>();
            }
        }
        if (GetComponent <Monster>() != null && Vector3.Distance(point, PlayerCharacter.players[0].transform.position) < 20f)
        {
            return(PlayerCharacter.players[0].GetComponent <StatusEffectHost>());
        }
        return(closestTarget);
    }