public void Execute() { ElfIdle(); if (elf.Target != null) { elf.ChangeElfState(new ElfPatrolState()); } }
private void Patrol() { elf.MyAnimator.SetFloat("speed", 0); patrolTimer += Time.deltaTime; if (patrolTimer >= patrolDuration) { elf.ChangeElfState(new ElfIdleState()); } }
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); }