Hello There, Guest!   Inicia Sesion Login Registrate Register La Hora Current time: 12-14-19, 12:04 AM
Login
Username/Email:
Password: Lost Password?
 
Lenny Face Gaming Forums
  • [ ] Portal
  • [ ] Forum
  • [ ] Members
  • [ ] Calendar
  • [ ] Help
  • Steam Group
  • GameTracker
  • Twitch
  • Youtube
Donations | Server List | Admin List | Bans | Praise The Overlord!
Home Lenny Face Gaming Forums › Lenny Face Gaming › General Chat › Spam Bin v
1 2 3 4 5 … 17 Next »

C# Coding Help Please
Thread Modes
C# Coding Help Please
« Next Oldest | Next Newest »
Views 59
Replies 1
Thread Closed 
Users browsing this thread: 1 Guest(s)
M-E-T-A Offline
Former 7 Year Old
***
Helpful (18)
Posts: 860
Threads: 104
Thanks: 39 in 33 posts
Thanks Given: 71
Joined: Jan 2017
Warning Level: 20%
gmod_donator_premium
Member
#1
12-1-19, 01:47 AM
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() { 
    
    }

}
[Image: lfg.png][Image: 36L7U.png]
Find
M-E-T-A Offline
Former 7 Year Old
***
Helpful (18)
Posts: 860
Threads: 104
Thanks: 39 in 33 posts
Thanks Given: 71
Joined: Jan 2017
Warning Level: 20%
gmod_donator_premium
Member
#2
12-1-19, 07:10 PM
nvm fixed it
[Image: lfg.png][Image: 36L7U.png]
Find
« Next Oldest | Next Newest »
Thread Closed 


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

  • Contact Us
  • Lenny Face Gaming Forums
  • Return to Top
  • Lite (Archive) Mode
  • Mark All Forums Read
  • RSS Syndication
Linear Mode
Threaded Mode