11-30-2019, 11:40 PM
Ok so I am working on a Boxing minigame for a game Im working on for an after school program and Im stuck on how to fix the errors. The errors are in red and what is wrong with it is wrong with it is summed up in italics and blue (according to microsoft visual studio). Please help me.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public enum EnemyState {
CHASE,
ATTACK
}
public class EnemyController : MonoBehaviour {
private NavMeshAgent navAgent;
private Transform playerTarget;
private EnemyState enemy_State;
public float move_Speed = 3.5f;
public float attack_Distance = 1f;
public float chase_Player_After_Attack_Distance = 1f;
private float wait_Before_Attack_Time = 3f;
private float attack_Timer;
void Awake() {
navAgent = GetComponent<NavMeshAgent>();
playerTarget = GameObject.FindGameObjectsWithTag("Player").transformCode: CS1061 transform is not defined nor accessible extension method;
}
void Start() {
enemy_State = EnemyState.CHASE;
attack_Timer = wait_Before_Attack_Time;
}
void Update() {
if(enemy_State == EnemyState.CHASE) {
ChasePlayer();
}
if(enemy_State == EnemyState.ATTACK) {
AttackPlayer();
}
}
void ChasePlayer() {
navAgent.SetDestination(playerTarget.position);
navAgent.speed = move_Speed;
if(Vector3.Distance(transform.position, playerTargetCode: CS1503 Cannot convert UnityEngine.transform to UnityEngine.Vector3) <= attack_Distance) {
enemy_State = EnemyState.ATTACK;
}
}
void AttackPlayer() {
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public enum EnemyState {
CHASE,
ATTACK
}
public class EnemyController : MonoBehaviour {
private NavMeshAgent navAgent;
private Transform playerTarget;
private EnemyState enemy_State;
public float move_Speed = 3.5f;
public float attack_Distance = 1f;
public float chase_Player_After_Attack_Distance = 1f;
private float wait_Before_Attack_Time = 3f;
private float attack_Timer;
void Awake() {
navAgent = GetComponent<NavMeshAgent>();
playerTarget = GameObject.FindGameObjectsWithTag("Player").transformCode: CS1061 transform is not defined nor accessible extension method;
}
void Start() {
enemy_State = EnemyState.CHASE;
attack_Timer = wait_Before_Attack_Time;
}
void Update() {
if(enemy_State == EnemyState.CHASE) {
ChasePlayer();
}
if(enemy_State == EnemyState.ATTACK) {
AttackPlayer();
}
}
void ChasePlayer() {
navAgent.SetDestination(playerTarget.position);
navAgent.speed = move_Speed;
if(Vector3.Distance(transform.position, playerTargetCode: CS1503 Cannot convert UnityEngine.transform to UnityEngine.Vector3) <= attack_Distance) {
enemy_State = EnemyState.ATTACK;
}
}
void AttackPlayer() {
}
}