public IEnumerator StartTurnPlayer(IHasTurn hasTurn) { yield return(StartCoroutine(SwitchToPlayerCamera())); _PointAtIHasTurn(); yield return(new WaitForSeconds(0.5f)); }
public void StartTurn(IHasTurn hasTurn) { MyActionEnum = ActionEnum.HasAction; MyBonusActionEnum = BonusActionEnum.HasBonusAction; MyReactionEnum = ReactionEnum.HasReaction; hasTurn.StartTurn(MyActionEnum, MyBonusActionEnum, MyReactionEnum); }
//---------------------------------------------------------------------------- // StartTurn //---------------------------------------------------------------------------- #region StartTurn public IEnumerator StartTurnScript(IHasTurn hasTurn) { CurrentHasTurn = hasTurn; CurrentHasTurnTransform = hasTurn.MyHexContents.ContentTransform; yield return(StartCoroutine(SwitchToScriptCamera())); _StartTurnFocus(); }
//---------------------------------------------------------------------------- // AddSingleDeathEvent //---------------------------------------------------------------------------- #region AddSingleDeathEvent public void AddSingleDeathEvent(IHasTurn hasTurn, IDeathEvent deathEvent) { if (!DeathEventDict.ContainsKey(hasTurn)) { DeathEventDict[hasTurn] = new List <IDeathEvent>(); } DeathEventDict[hasTurn].Add(deathEvent); }
//---------------------------------------------------------------------------- // Attack //---------------------------------------------------------------------------- #region Attack public void Attack(IHasTurn attacker, IContents victim) { MyAttackerTurn = attacker; MyVictimContents = victim; MyHasAttack = MyAttackerTurn.MyHasAttack; MyIsVictim = MyVictimContents.MyHasTurn.MyIsVictim; StartCoroutine(AttackCoroutine()); }
//---------------------------------------------------------------------------- // SelectAttackTarget //---------------------------------------------------------------------------- #region SelectAttackTarget /// <summary> /// Called when the move button is pressed. <para/> /// Updates the CurrentHasMove, then makes all attackable hexes in range clickable and green. /// </summary> public void SelectAttackTarget(IHasTurn currentIHasTurn) { CurrentHasTurn = currentIHasTurn; TargetsInRange = MyAttackRanges.GetTargetsInRange(currentIHasTurn.MyHexContents.Location, 1); foreach (IHexagon target in TargetsInRange) { target.Interaction.ChangeColor(ClickableColor); target.Interaction.MakeSelectable(); } }
//---------------------------------------------------------------------------- // DoMove //---------------------------------------------------------------------------- #region DoMove /// <summary> /// Called by a movement controller to move the IHasTurn to the end of path /// </summary> public void DoMove(IHasTurn hasTurn, MapPath path) { MyHasTurn = hasTurn; ContentTransform = MyHasTurn.MyHexContents.ContentTransform; Path = path; StopAllCoroutines(); RemoveStartLocationFromPath(); StartCoroutine(MoveToDestination()); }
public void AddAlteration(RollType rollType, IHasTurn hasTurn, IRollDataAlteration alteration) { RollDictID rollDictID = new RollDictID(hasTurn, rollType); if (!RollAlterationDict.ContainsKey(rollDictID)) { RollAlterationDict[rollDictID] = new List <IRollDataAlteration>(); } RollAlterationDict[rollDictID].Add(alteration); }
//---------------------------------------------------------------------------- // ReactToDeath //---------------------------------------------------------------------------- #region ReactToDeath public IEnumerator ReactToDeath(IHasTurn hasTurn) { TurnList.Remove(hasTurn); HasTurnMaxIndex--; if (CurrentTurn >= hasTurn.Index) { CurrentTurn--; TurnChangeover(); } yield break; }
//---------------------------------------------------------------------------- // SelectMoveDestination //---------------------------------------------------------------------------- #region SelectMoveDestination /// <summary> /// Show all IHexagons a character can move to and make them clickable /// </summary> /// <param name="currentIHasTurn"></param> public void SelectMoveDestination(IHasTurn currentIHasTurn) { HexesInRange = MyMapPathfinding.GetHexesInRange(currentIHasTurn.MyHexContents.Location, currentIHasTurn.MyHasSpeed.CurrentMovement()); HexesInRange.Remove(currentIHasTurn.MyHexContents.Location); CurrentIHasTurn = currentIHasTurn; foreach (IHexagon hex in HexesInRange) { hex.Interaction.MakeSelectable(); hex.Interaction.ChangeColor(Color.red); } }
//---------------------------------------------------------------------------- // Death //---------------------------------------------------------------------------- public IEnumerator HasTurnDeath(IHasTurn hasTurn) { MyTextMesh.text = hasTurn.Name + " falls to the ground, clutching their chest. Their face drains " + "of blood, before they collapse entirely. Dead."; while (!Input.GetMouseButton(0)) { yield return(null); } yield return(StartCoroutine(HideCanvas())); yield return(new WaitForSeconds(0.2f)); }
public void Roll(RollType rollType, IHasTurn hasTurn, IRollData rollData) { RollDictID rollDictID = new RollDictID(hasTurn, rollType); if (RollAlterationDict.ContainsKey(rollDictID)) { foreach (IRollDataAlteration rollDataAlteration in RollAlterationDict[rollDictID]) { rollDataAlteration.Alter(rollData); } } int rollInt = MyAdvantageRoller.Roll(rollData.MyAdvantageSetter); rollData.SetRoll(rollInt); }
public IEnumerator EndAttackEvent(IHasTurn hasTurn) { yield return(new WaitForSeconds(1f)); StartCoroutine(MyBattleCamManager.ChangeSwitchSpeed(0.5f)); yield return(StartCoroutine(MyBattleCamManager.FocusOnDeath(DyingHasTurn.MyHexContents.ContentTransform))); StartCoroutine(MyBattleCamManager.ChangeSwitchSpeed(0.4f)); yield return(StartCoroutine(MyBattleCamManager.SwitchToScriptCamera())); Destroy(DyingHasTurn.MyHexContents.ContentTransform.gameObject); yield return(new WaitForSeconds(2.5f)); MyAttackManager.RemoveEndAttackEvent(this); StartCoroutine(MyBattleCamManager.ChangeSwitchSpeed(0.6f)); yield break; }
private void _BuildTurnList() { HasTurnMarker[] TurnMarkerArray = FindObjectsOfType <HasTurnMarker>(); HasTurnMaxIndex = -1; foreach (HasTurnMarker turnMarker in TurnMarkerArray) { HasTurnMaxIndex++; IHasTurn hasTurn = turnMarker.gameObject.GetComponent <IHasTurn>(); hasTurn.Initialise(this); TurnList.Add(turnMarker.gameObject.GetComponent <IHasTurn>()); hasTurn.Index = HasTurnMaxIndex; } TurnList.Sort(new TurnSort()); CurrentTurn = -1; }
//---------------------------------------------------------------------------- // StartTurn //---------------------------------------------------------------------------- #region StartTurn public IEnumerator StartTurn(IHasTurn hasTurn) { yield return(new WaitForSeconds(1)); MyTextMesh.text = hasTurn.Name + " is up next, rolling a " + hasTurn.Initiative.PureRollValue + " + " + hasTurn.Initiative.Mods + "."; yield return(StartCoroutine(ShowCanvas())); while (!Input.GetMouseButton(0)) { yield return(null); } yield return(StartCoroutine(HideCanvas())); yield return(new WaitForSeconds(0.2f)); }
//---------------------------------------------------------------------------- // Die //---------------------------------------------------------------------------- #region Die public IEnumerator Die(IHasTurn hasTurn) { DyingHasTurn = hasTurn; if (DeathEventDict.ContainsKey(hasTurn)) { foreach (IDeathEvent deathEvent in DeathEventDict[hasTurn]) { yield return(StartCoroutine(deathEvent.ReactToDeath(hasTurn))); } } foreach (IDeathEvent globalDeathEvent in GlobalDeathEvents) { yield return(StartCoroutine(globalDeathEvent.ReactToDeath(hasTurn))); } MyAttackManager.AddEndAttackEvent(this); }
public IEnumerator TurnChangeoverCoroutine() { UpdateCurrentTurn(); IHasTurn hasTurn = TurnList[CurrentTurn]; Coroutine camCoroutine = StartCoroutine(MyCamManager.StartTurnScript(hasTurn)); yield return(StartCoroutine(MyNarrator.StartTurn(hasTurn))); StopCoroutine(camCoroutine); yield return(StartCoroutine(MyCamManager.StartTurnPlayer(hasTurn))); foreach (IStartTurnEvent startTurnEvent in StartTurnEvents) { yield return(StartCoroutine(startTurnEvent.StartTurn(hasTurn))); } //hasTurn.StartTurn(); }
public void RegisterHasTurn(IHasTurn hasTurn) { MyHasTurn = hasTurn; }
public RollDictID(IHasTurn hasTurn, RollType rollType) { MyHasTurn = hasTurn; MyRollType = rollType; }
//---------------------------------------------------------------------------- // StartTurn //---------------------------------------------------------------------------- #region StartTurn public IEnumerator StartTurn(IHasTurn currentIHasTurn) { CurrentIHasTurn = currentIHasTurn; ShowTurnUI(); yield break; }
public IEnumerator ReactToDeath(IHasTurn hasTurn) { Location.Contents = null; yield break; }