public void Follow(GameObject obj, Vector3 offset) { this.obj = obj; this.offset = offset; position = obj.Position + offset; rotation = obj.Rotation; //obj.Visible = false; }
public void Follow(GameObject obj) { this.obj = obj; this.offset = Vector3.Zero; position = obj.Position; rotation = obj.Rotation; //obj.Visible = false; }
/// <summary> /// Add a game object to the list. /// </summary> /// <param name="obj">The game object to add.</param> public void Add(GameObject obj) { obj.Parent = this; for (int i = 0; i < gameObjects.Count; i++) { if (gameObjects[i].Layer > obj.Layer) { gameObjects.Insert(i, obj); return; } } gameObjects.Add(obj); }
/// <summary> /// This game object handles the input of a target game object. /// </summary> /// <param name="target">The target game object to move. Can be null for none.</param> public MovementHandler(GameObject target = null) : base("movementHandler", -1) { Target = target; }
public void Unfollow() { obj.Visible = true; obj = null; }
/// <summary> /// Removes a game object from the list. /// </summary> /// <param name="obj">The game object to remove.</param> public void Remove(GameObject obj) { obj.Parent = null; gameObjects.Remove(obj); }