Hello a newbie here,
So here’s my code;
using UnityEngine;
using System.Collections;
public class controller : MonoBehaviour {
private bool walking = false;
private Vector3 spawnPoint;
public float speed;
// Use this for initialization
void Start () {
spawnPoint = transform.position;
}
// Update is called once per frame
void Update () {
if (walking) {
transform.position = transform.position + Camera.main.transform.forward * .5f * Time.deltaTime;
}
if (transform.position.y < -10f) {
transform.position = spawnPoint;
}
Ray ray = Camera.main.ViewportPointToRay (new Vector3 (.5f, .5f, 0));
RaycastHit hit;
if (Physics.Raycast (ray, out hit)) {
if (hit.collider.name.Contains(“Xenomorph”))
{
walking = false;
} else {
walking = true;
}
}
}
}
I assume this one is a pretty simple one. What I want to add to this is, character does not move at the very beginning of the game for 10 seconds and then, character movement stops completely at the end of the game. For the second part, I am thinking about using Xenomorph’s so I may be able to figure that one out if no one will have any suggestions (or I may learn the checkpoint codes I am not sure) but for the first part, I really need help… I tried everything I know so far (adding walls and make them move up etc.) nothing worked out for me. On Google search people talk about disabling the movement script but I don’t know how to disable and then enable it during the game. Please help me out!
Thanks!