Exemple #1
0
    public override void OnStateEnter(BaseStateMachine m)
    {
        ai.QuitPath();
        if (searchBench)
        {
            Physics2D.OverlapCircleNonAlloc(localFSM.transform.position, 7, availableBenches);
            Collider2D b = null;

            foreach (Collider2D bench in availableBenches)
            {
                if (bench != null && bench.CompareTag("REST"))
                {
                    b = bench;
                }
            }



            if (b != null)
            {
                ai.OnFinishPath += Rejuvenate;
                ai.SetDestination(b.transform.position);
            }
            else
            {
                //F**K IT
                Rejuvenate();
            }
        }
        else
        {
            Rejuvenate();
        }
    }
Exemple #2
0
    void PossessTarget()
    {
        victim           = target.GetComponent <AiCore>();
        job.victim       = victim;
        job.life.intType = life.life;
        victim.QuitPath();
        victim.tempSpell = fireball;
        foreach (MyStateMachine.BaseStateMachine j in victim.listOfJobs)
        {
            j.enabled = false;
        }

        transform.SetParent(target);

        job.tranformToDemon.fromSprite = victim.sprite;
        job.tranformToDemon.toSprite   = formSprite;
        job.tranformToDemon.hitbox     = hitbox;
        job.tranformToDemon.toState    = true;


        job.returnBackToNormal.fromSprite = formSprite;
        job.returnBackToNormal.toSprite   = victim.sprite;
        job.returnBackToNormal.hitbox     = hitbox;
        job.returnBackToNormal.toState    = false;

        job.deathReturnNormalForm.fromSprite = formSprite;
        job.deathReturnNormalForm.toSprite   = victim.sprite;
        job.deathReturnNormalForm.hitbox     = hitbox;
        job.deathReturnNormalForm.toState    = false;



        job.InitializeNewBody();
        particles.Stop();
        body.bodyType = RigidbodyType2D.Kinematic;
        col.enabled   = false;
        state         = SoulStates.POSSESS;
    }