public void SetEndPipeConfig() { GameShapeType type = GameShapeType.CIRCLE; Vector3 vector3 = new Vector3(0f, -3f, 0); GamePipeEnd pipeEnd1 = new GamePipeEnd(type, vector3); vector3 = new Vector3(2f, -3f, 0); type = GameShapeType.SQUARE; GamePipeEnd pipeEnd2 = new GamePipeEnd(type, vector3); vector3 = new Vector3(-2f, -3f, 0); type = GameShapeType.TRIANGLE; GamePipeEnd pipeEnd3 = new GamePipeEnd(type, vector3); GamePipeEnd[] pipeEndArray = { pipeEnd1, pipeEnd2, pipeEnd3 }; pipeEnds = pipeEndArray; if (onPipeEndAdded != null) { foreach (GamePipeEnd pipeEnd in pipeEndArray) { onPipeEndAdded(pipeEnd); } } }
public void SetPipeFromSpawner(GameSpawner spawner, GamePipeEnd pipeEnd) { if (spawner.AttachedPipe == null) { AddPipe(spawner, pipeEnd); } else { UpdatePipeEnd(spawner.AttachedPipe, pipeEnd); } }
public static void CreatePipeEnd(GameObject pipeEndPrefab, GameObject parent, GamePipeEnd pipeDef, GamePlumbingView gamePlumbingView) { GameObject pipeEndObj = Instantiate(pipeEndPrefab, pipeDef.Position, Quaternion.identity); pipeEndObj.transform.SetParent(parent.transform); GamePipeEndView component = pipeEndObj.AddComponent <GamePipeEndView>(); component.gamePlumbingView = gamePlumbingView; component.PipeEnd = pipeDef; component.InitPipeEnd(); }
private GamePipe AddPipe(GameSpawner spawner, GamePipeEnd end) { GamePipe newPipe = new GamePipe(spawner, end); pipes.Add(newPipe); spawner.AttachPipe(newPipe); if (onPipeAdded != null) { onPipeAdded(newPipe); } return(newPipe); }
private void OnPipeEndAdded(GamePipeEnd pipeEnd) { GameObject prefab = GetPipeEndPrefab(pipeEnd.Type); GamePipeEndView.CreatePipeEnd(prefab, pipeEndParent, pipeEnd, gamePlumbingView); }
public void UpdatePipeEnd(GamePipe pipe, GamePipeEnd pipeEnd) { pipe.UpdateGamePipeEnd(pipeEnd, pipeEnd.Type); shapeController.OnPipeUpdated(pipe); }
public void UpdateGamePipeEnd(GamePipeEnd newEnd, GameShapeType newEndType) { pipeEnd = newEnd; pipeSize = Vector3.Distance(StartPoint, CurrentEnd); OnPipeUpdated(this); }
public GamePipe(GameSpawner spawner, GamePipeEnd startEnd) { this.spawner = spawner; pipeEnd = startEnd; State = GamePipeState.WRONG; }
private void UpdatePipeEnd(GamePipeEnd pipeEnd) { UpdatePipe(origin, pipeEnd.Position); gamePlumbingController.UpdatePipeEnd(updatedPipe, pipeEnd); }