// Use this for initialization void Initialise() { m_Health = Health; UserAxis = new Movement_Axis(); UserAxis.SetXY(0, 0); m_Speed_X = Speed_X; m_Speed_Y = Speed_Y; }
public void Move(Movement_Axis Direction) { // Movement has been done in this way so that the Player and the enemies can use the same movement scripts and mechanics. // Can be fed manual input or a programmed sequence Vector3 Position = transform.position; Position.x += (Speed_X + Time.deltaTime) * UserAxis.GetX(); Position.y += (Speed_Y + Time.deltaTime) * UserAxis.GetY(); Position.z = transform.position.z; transform.position = Position; }
void Start() { axis = new Movement_Axis(); axis.roll = 0f; axis.pitch = 0f; axis.yaw = 0f; axis.thrust = 10f; rb = GetComponent <Rigidbody>(); gm = GameObject.FindWithTag("GameController").GetComponent <GameManager>(); cam = Camera.main.gameObject; ui = GameObject.FindWithTag("UI").GetComponent <UIManager>(); }