Created
March 7, 2016 08:27
-
-
Save ted80/316be9a4b38221d79dcc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class AIMovement : MonoBehaviour | |
{ | |
[SerializeField] private NavMeshAgent navMeshAgent; | |
public GameObject head; | |
public GameObject playerHead; | |
public bool MoveTo(Vector3 point) | |
{ | |
if(navMeshAgent.SetDestination(point)) | |
{ | |
navMeshAgent.speed = 3f; | |
navMeshAgent.Resume(); | |
return true; | |
} | |
return false; | |
} | |
public void shootAtPlayer() | |
{ | |
gameObject.transform.LookAt(getPlayerPosition()); | |
} | |
public void stopShooting() | |
{ | |
} | |
public void reloadWeapon() | |
{ | |
} | |
public int getBulletsLeft() | |
{ | |
return 0; | |
} | |
public float getMovingDistance() | |
{ | |
return navMeshAgent.remainingDistance; | |
} | |
public void stopMoving() | |
{ | |
navMeshAgent.Stop(); | |
} | |
public Vector3 getHeadPosition() | |
{ | |
return head.transform.position; | |
} | |
public Vector3 getPlayerHeadPosition() | |
{ | |
return playerHead.transform.position; | |
} | |
public Vector3 getPlayerPosition() | |
{ | |
return playerHead.transform.position; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment