private void OnMouseDown() { if (canWalkTo) { if (currentStepingGameTool != null) { game.SetToolUI(currentStepingGameTool, currentStepingGameTool.GetComponentInParent <Loading>(), false); } game.SetToolUI(game.GetClickedTile().currentStepingGameTool, game.GetClickedTile().currentStepingGameTool.GetComponentInParent <Loading>(), false); game.MoveTo(GetComponent <Tile>()); } else if (!canWalkTo && canBeClicked && game.GetClickedTile() != this) { if (gameToolResized) { currentStepingGameTool.gameObject.transform.localScale -= currentStepingGameTool.GetResizeFactor(); gameToolResized = false; } game.SetClickedTile(GetComponent <Tile>()); game.SetToolUI(currentStepingGameTool, currentStepingGameTool.GetComponentInParent <Loading>(), true); } else if (!canWalkTo && canBeClicked && game.GetClickedTile() == this) { game.ResetClickedTile(); game.SetToolUI(currentStepingGameTool, currentStepingGameTool.GetComponentInParent <Loading>(), false); } }
private void OnMouseDown() { if (Loaded != null && Loaded.GetToolsPlayerId() == game.GetTurnPlayerID()) { if (Loader.GetComponentInParent <Loading>().GetReadyToUnloadTool() == null) { Loader.GetComponentInParent <Loading>().SetReadyToUnloadTool(Loader, Loaded); } else { if (Loader == game.GetLoader()) { if (Loaded.GetComponentInParent <Loading>().CanBeLoadTo(Loader.GetComponentInParent <Loading>().GetReadyToUnloadTool())) { Loader.GetComponentInParent <Loading>().LoadToolOnReadyToUnloadTool(Loaded); game.SetClickedLoadedTool(Loader, Loader.GetComponentInParent <Loading>().GetReadyToUnloadTool()); } } else { Loader.GetComponentInParent <Loading>().SetReadyToUnloadTool(Loader, Loaded); } } } }
public void Load(GameTool gameTool, Tile loadFrom = null) { Debug.Log(gameTool.transform.position); if (gameTool.GetName() != "Flag") { loadedGameTools.Add(gameTool); if (loadFrom != null) { loadFrom.SetCurrentStepingGameTool(null); } Debug.Log(gameTool.transform.position); foreach (Transform child in gameTool.gameObject.transform.parent) { child.gameObject.transform.localScale = Vector3.zero; } //gameTool.gameObject.transform.parent.position = transform.parent.position; //gameTool.gameObject.transform.parent.parent = transform.parent; gameTool.GetComponentInParent <Loading>().SetLoader(GetComponentInParent <GameTool>()); Debug.Log(gameTool.transform.position); game.PassTurn(); } else { loadedGameTools.Add(gameTool); if (loadFrom != null) { loadFrom.SetCurrentStepingGameTool(null); } foreach (Transform child in gameTool.gameObject.transform.parent) { child.gameObject.transform.localScale = Vector3.zero; } //gameTool.gameObject.transform.parent.position = transform.parent.position; //gameTool.gameObject.transform.parent.parent = transform.parent; HasFlag = true; } Debug.Log(gameTool.transform.position); }
public bool CanBeLoadTo(GameTool gameTool) { if (gameTool.GetName() == "Flag") { return(false); } if (!canBeLoaded || gameTool.transform.parent.tag == "Soldier") { return(false); } else { if (loadedGameTools.Count + 1 + gameTool.GetComponentInParent <Loading>().loadedGameTools.Count <= gameTool.GetComponentInParent <Loading>().loadCapability) { return(true); } else { return(false); } } }
public void LoadToolOnReadyToUnloadTool(GameTool gametool) { ReadyToUnloadTool.GetComponentInParent <Loading>().Load(gametool); }