Advertisement
elsemTim

controller

Nov 1st, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. namespace Assets.Script
  4. {
  5.     public class EnemyController : MonoBehaviour
  6.     {
  7.         private GameObject playerCharacter;
  8.         private CharacterController controller;
  9.         private Vector3 _moveDirection = Vector3.zero;
  10.         private float _speed=20.0F;
  11.         private int _damage;
  12.         private int _visibilityDistance;
  13.        
  14.         public void MoveTo()
  15.         {
  16.             controller = GetComponent<CharacterController>();
  17.             _moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
  18.             _moveDirection = transform.TransformDirection(_moveDirection);
  19.             _moveDirection *= _speed;
  20.             controller.Move(_moveDirection);
  21.            
  22.         }
  23.         public void Attack() { }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement