Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C# Coding Help Please
#1
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() { 
    
    }

}


Messages In This Thread
C# Coding Help Please - by Soul alt - 11-30-2019, 11:40 PM
RE: C# Coding Help Please - by Noire ♜ - 12-01-2019, 02:59 AM
RE: C# Coding Help Please - by Soul alt - 12-01-2019, 05:35 PM
RE: C# Coding Help Please - by Inferno - 12-02-2019, 08:52 AM
RE: C# Coding Help Please - by Tedgp908 &gt;:( - 12-02-2019, 09:47 PM
RE: C# Coding Help Please - by Soul alt - 12-03-2019, 12:32 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)

About Us
    This is Dinkleberg's GMod, a gaming community based in Garry's Mod. We have a Trouble in Terrorist Town, Prop Hunt, Murder, and Deathrun Server. Come check them out sometime.