public GPlayerChess Spawn(PlayerChessData data) { GPlayerChess chess = Spawn(data.prototype); chess.InitWithSaveData(data); return(chess); }
public void SwitchToSelected(GPlayerChess chess) { switch (inputState) { case InputState.Skill: selectedSkill = null; selectedChess.CancelSkill(); selectTask.bPaused = false; curTask.Abort(); curTask = null; break; case InputState.Selected: curTask.Abort(); curTask = null; Select(chess); break; case InputState.ReadyToSelect: Select(chess); break; default: Debug.LogError("ErrorState"); break; } ; curTask = CreateMoveCommand(chess); curTask.CreateFloorHUD(new Color(0, 1, 0, 0.8f)); curTask.Begin(); inputState = InputState.Selected; }
public async void PerformChessSkill(GPlayerChess chess, PlayerSkill skill, GActor[] inputParams) { bProcessing = true; await chess.PerformSkill(skill, inputParams); bProcessing = false; eSkillPerformEnd.Invoke(); SwitchToSelected(chess); }
public async void CallChessToMoveAsync(GPlayerChess chess, Vector2Int location) { bProcessing = true; await currentPlayerTurn.BeforeMoveReaction(chess, location); await chess.MoveToAsync(location); bProcessing = false; SwitchToSelected(chess); }
public void Bind(GPlayerChess selectedChess) { this.selectedChess = selectedChess; SwitchSkillButton(selectedChess.skills); Refresh(); selectedChess.APAttribute.AddListener(Refresh); selectedChess.eSkillChange.AddListener(ReCreateSkillButton); PlayerControlManager.instance.eProcessStart.AddListener(Refresh); PlayerControlManager.instance.eProcessEnd.AddListener(Refresh); aPDisplay.Bind(selectedChess); }
//取消选中 protected void DeSelect() { if (!selectedChess) { return; } var temp = selectedChess; selectedChess = null; temp.GetComponent <CAgentComponent>().eDeselect.Invoke(); eDeselect.Invoke(); }
public GPlayerChess Spawn(GameObject prototype) { GameObject go = Instantiate(prototype, GridManager.instance.chessContainer); go.transform.position = GridManager.instance.GetChessPosition3D(location); GPlayerChess chess = go.GetComponent <GPlayerChess>(); chess.location = location; chess.prefabPrototype = prototype; Destroy(gameObject); return(chess); }
public static RangeTask CreateMoveCommand(GPlayerChess chess) { Action <GActor[]> t = (o) => { instance.CallChessToMoveAsync(chess, o[0].location); }; Func <int, GActor, bool> checker = (index, target) => { return(!GridManager.instance.GetChess(target.location)); }; return(new RangeTask(chess.navComponent.GetMoveRange, t, 1, checker)); }
async public UniTask BeforeMoveReaction(GPlayerChess chess, Vector2Int location) { foreach (GAIChess ai in GridManager.instance.aiChesses) { if (ai?.bDead == false) { if (ai.aiCompoment.postSkillReady && ai.postSkill.IsLockAt(chess)) { await ai.aiCompoment.PostAction(); } } } }
public async UniTask AssignSkill(GPlayerChess target, PlayerSkill skill, PlayerSkill replaceSkill) { await Shoot(target.location); if (replaceSkill == null) { target.AddSkill(skill); } else { target.ReplaceSkill(skill, replaceSkill); } }
protected void Select(GChess target) { if (target == selectedChess) { return; } if (selectedChess != null) { DeSelect(); } selectedChess = target as GPlayerChess; selectedChess.GetComponent <CAgentComponent>().eSelect.Invoke(); eSelectChess.Invoke(selectedChess); }
public GChess InstansiateChessAt(GameObject prefab, Vector2Int location) { var res = Instantiate(prefab, chessContainer); res.transform.position = GetChessPosition3D(location); GChess chess = res.GetComponent <GChess>(); chess.location = location; if (chess is GPlayerChess) { GPlayerChess playerChess = chess as GPlayerChess; GameObject originPrefab = prefab.GetComponent <GPlayerChess>().prefabPrototype; if (originPrefab == null) { originPrefab = prefab; } playerChess.prefabPrototype = originPrefab; } AddChess(chess); chess.render.GetComponent <Animator>().Play("Birth"); return(chess); }
public async UniTask OpenChestAsync(GChest chest) { chest.Open(); int stage = 0; PlayerSkill addSkill = null; GPlayerChess target = null; PlayerSkill replaceSkill = null; while (0 <= stage && stage <= 2) { switch (stage) { case 0: addSkill = await GetSkillAsync(chest.storeSkills); if (addSkill == null) { stage--; } else { stage++; } break; case 1: target = await GetNextClickChessAsync <GPlayerChess>(); if (target == null) { stage--; } else { stage++; if (!target.skillContainFull) { replaceSkill = null; stage++; } } break; case 2: replaceSkill = await GetSkillAsync(target.skills); if (target == null) { stage--; } else { stage++; } break; } } if (stage == -1) { chest.Close(); } else if (stage == 3) { await chest.AssignSkill(addSkill, target, replaceSkill); chest.Close(); } }
async public UniTask AssignSkill(PlayerSkill skill, GPlayerChess target, PlayerSkill replaceSkill) { await chestSkill.AssignSkill(target, skill, replaceSkill); }
async public override UniTask ProcessAsync(GActor[] inputParams) { GPlayerChess target = inputParams[0] as GPlayerChess; target.AddSkill(addSKill); }
public void UnBind() { selectedChess.APAttribute.RemoveListener(Refresh); selectedChess = null; }
public void Bind(GPlayerChess selectedChess) { this.selectedChess = selectedChess; selectedChess.APAttribute.AddListener(Refresh); Refresh(); }