public void Start() { Debug.Log("Starting " + this.GetType() + " Behaviour"); Entities.Ship ship = (Entities.Ship)owner; velocity = ship.maxthrust; }
public void Update() { Debug.Log(turn); Entities.Ship ship = (Entities.Ship)owner; Vector3 targetDir = position - ship.transform.position; // The step size is equal to speed times frame time. float step = ship.speed * Time.deltaTime; Vector3 newDir = Vector3.RotateTowards(ship.transform.forward, targetDir, step, 0.0f); if (turn) { ship.transform.rotation = Quaternion.LookRotation(newDir); } Debug.DrawRay(ship.transform.position, newDir, Color.red); //Debug.DrawLine(ship.transform.position, position, Color.blue); if (Vector3.Distance(ship.transform.position, position) <= 0.5) { ship.computer.SetCMD(Entities.Computer.CMD.FLYTO); } }