Beispiel #1
0
    public IEnumerator Start()
    {
        Responsible.JobFinished   = false;
        Responsible.TargetInRange = false;

        if (Target)
        {
            Responsible.Target = Target.gameObject;
        }

        Responsible.StartCoroutine(Coroutine);

        if (!Responsible.Inventory.InInventory(Target.gameObject))
        {
            yield return(new WaitUntil(() => Responsible.TargetInRange));
        }

        if (Target == null || Target.InUse <= 0 || !Target.Methods.Contains(Method))
        {
            Debug.Log("Target is already in use!");
            Stop(true);
            yield break;
        }

        _started = true;
        Debug.Log("Reached to the target now I'm gonna start doing my job!");
        Target.InUse--;
        SkillManager.AddSkill(Responsible, SkillFactory.GetSkill(SkillType));
        EffectManager.Apply(Responsible, Effects);
    }