Exemple #1
0
    public void Execute()
    {
        ElfIdle();

        if (elf.Target != null)
        {
            elf.ChangeElfState(new ElfPatrolState());
        }
    }
Exemple #2
0
    private void Patrol()
    {
        elf.MyAnimator.SetFloat("speed", 0);

        patrolTimer += Time.deltaTime;

        if (patrolTimer >= patrolDuration)
        {
            elf.ChangeElfState(new ElfIdleState());
        }
    }
Exemple #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Coin")
        {
            elf.Target = other.gameObject;
        }

        if (other.tag == "Player")
        {
            elf.ChangeDirection();
            elf.ChangeElfState(new ElfPatrolState());
        }

        //Debug.Log("Elf's Target: " + elf.Target);
    }