public Dice(DiceKind type, DiceSide side = DiceSide.Unknown) { Model = SpawnDice(type); Sides = new List <DiceSide>(); Sides.Add(DiceSide.Blank); Sides.Add(DiceSide.Blank); Sides.Add(DiceSide.Focus); Sides.Add(DiceSide.Focus); Sides.Add(DiceSide.Success); Sides.Add(DiceSide.Success); Sides.Add(DiceSide.Success); if (type == DiceKind.Attack) { Sides.Add(DiceSide.Crit); } if (type == DiceKind.Defence) { Sides.Add(DiceSide.Blank); } if (side != DiceSide.Unknown) { Side = side; //TODO: Not only success Model.transform.Find("Dice").localEulerAngles = rotationSuccess; } else { Side = Sides[Random.Range(0, 8)]; } }
public Dice(DiceRoll diceRoll, DiceKind type, DiceSide side = DiceSide.Unknown) { ParentDiceRoll = diceRoll; Type = type; Sides = new List <DiceSide> { DiceSide.Blank, DiceSide.Blank, DiceSide.Focus, DiceSide.Focus, DiceSide.Success, DiceSide.Success, DiceSide.Success }; if (type == DiceKind.Attack) { Sides.Add(DiceSide.Crit); } if (type == DiceKind.Defence) { Sides.Add(DiceSide.Blank); } if (side != DiceSide.Unknown) { Side = side; } else { Side = Sides[Random.Range(0, 8)]; } }
private void GenerateDiceRoll(DiceKind type, int number) { DiceList = new List <Dice>(); for (int i = 0; i < number; i++) { DiceList.Add(new Dice(type)); } }
private GameObject SpawnDice(DiceKind type) { GameObject prefabDiceType = (type == DiceKind.Attack) ? Dices.DiceAttack : Dices.DiceDefence; Transform diceSpawningPoint = Dices.DiceSpawningPoint; GameObject model = MonoBehaviour.Instantiate(prefabDiceType, diceSpawningPoint.transform.position, prefabDiceType.transform.rotation, diceSpawningPoint.transform); return(model); }
public DiceStatsEntry(DiceKind diceKind, DieSide dieSide, PlayerDiceStats playerStats, StatsViewScript script) { DiceKind = diceKind; DieSide = dieSide; PlayerStats = playerStats; Text = script.transform.Find(DiceKind.ToString()).Find("P" + Tools.PlayerToInt(PlayerStats.PlayerNo)).Find(DieSide.ToString()).GetComponent <Text>(); }
private GameObject SpawnDice(DiceKind type) { GameObject prefabDiceType = (type == DiceKind.Attack) ? DiceManager.DiceAttack : DiceManager.DiceDefence; Transform diceSpawningPoint = ParentDiceRoll.SpawningPoint; GameObject model = MonoBehaviour.Instantiate(prefabDiceType, diceSpawningPoint.transform.position, prefabDiceType.transform.rotation, diceSpawningPoint.transform); model.name = "DiceN" + diceIDcounter++; return(model); }
private void StartQuestionSubphase(object sender, System.EventArgs e) { if (HostShip.Owner.Id == Combat.Attacker.Owner.Id && Combat.AttackStep == CombatStep.Attack) // We're attacking { DiceType = DiceKind.Attack; ShipUsingPalpatine = Combat.Attacker; } else { if (HostShip.Owner.Id == Combat.Defender.Owner.Id && Combat.AttackStep == CombatStep.Defence) // We're defending { DiceType = DiceKind.Defence; ShipUsingPalpatine = Combat.Defender; } else { // We're doing something else - for future non-combat Palpatine Triggers.FinishTrigger(); return; } } EmperorPalpatineDecisionSubPhase newSubPhase = (EmperorPalpatineDecisionSubPhase)Phases.StartTemporarySubPhaseNew( Name, typeof(EmperorPalpatineDecisionSubPhase), Triggers.FinishTrigger ); newSubPhase.DescriptionShort = "Emperor Palpatine"; newSubPhase.DescriptionLong = "Name a die result. After rolling, you must change 1 of your dice results to the named result."; newSubPhase.ImageSource = HostUpgrade; newSubPhase.RequiredPlayer = HostShip.Owner.PlayerNo; newSubPhase.ShowSkipButton = true; newSubPhase.OnSkipButtonIsPressed = DontUseEmperorPalpatine; if (DiceType == DiceKind.Attack) { newSubPhase.AddDecision("Critical Hit", ChoiceCriticalHit); newSubPhase.AddDecision("Hit", ChoiceHit); } else { if (DiceType == DiceKind.Defence) { newSubPhase.AddDecision("Evade", ChoiceEvade); } } newSubPhase.AddDecision("Focus", ChoiceFocus); newSubPhase.AddDecision("Blank", ChoiceBlank); newSubPhase.DefaultDecisionName = GetDefaultDecision(); newSubPhase.Start(); }
private void UpdateStats(DiceKind diceKind) { foreach (DiceStatsEntry entry in DiceStats.Where(n => n.DiceKind == diceKind && n.DieSide != DieSide.Unknown)) { int rolled = DiceStats.Find(n => n.DiceKind == diceKind && n.DieSide == DieSide.Unknown).Count; float part = (float)entry.Count / (float)rolled; float difference = part - DiceChances[entry.DiceKind][entry.DieSide]; entry.Text.text = String.Format("{0} ({1:+0.00;-0.00;0.00}%)", entry.Count, difference * 100); } }
private void StartQuestionSubphase(object sender, System.EventArgs e) { if (HostShip.Owner.Id == Combat.Attacker.Owner.Id && Combat.AttackStep == CombatStep.Attack) // We're attacking { DiceType = DiceKind.Attack; ShipUsingPalpatine = Combat.Attacker; } else { if (HostShip.Owner.Id == Combat.Defender.Owner.Id && Combat.AttackStep == CombatStep.Defence) // We're defending { DiceType = DiceKind.Defence; ShipUsingPalpatine = Combat.Defender; } else { // We're doing something else - for future non-combat Palpatine Triggers.FinishTrigger(); return; } } EmperorPalpatineDecisionSubPhase newSubPhase = (EmperorPalpatineDecisionSubPhase)Phases.StartTemporarySubPhaseNew( Name, typeof(EmperorPalpatineDecisionSubPhase), Triggers.FinishTrigger ); newSubPhase.RequiredPlayer = HostShip.Owner.PlayerNo; newSubPhase.InfoText = "Use " + Name + "?"; newSubPhase.AddDecision("No", DontUseEmperorPalpatine); if (DiceType == DiceKind.Attack) { newSubPhase.AddDecision("Critical Hit", ChoiceCriticalHit); newSubPhase.AddDecision("Hit", ChoiceHit); } else { if (DiceType == DiceKind.Defence) { newSubPhase.AddDecision("Evade", ChoiceEvade); } } newSubPhase.AddDecision("Focus", ChoiceFocus); newSubPhase.AddDecision("Blank", ChoiceBlank); newSubPhase.DefaultDecisionName = GetDefaultDecision(); newSubPhase.Start(); }
public DiceRoll(DiceKind type, int number, DiceRollCheckType checkType) { Type = type; CountOfInitialRoll = number; CheckType = checkType; if (checkType != DiceRollCheckType.Virtual) { SetSpawningPoint(); } GenerateDiceRoll(); }
// INITIALIZE public DiceRoll(DiceKind type, int countOfInitialRoll, DiceRollCheckType checkType, PlayerNo owner = PlayerNo.PlayerNone) { Type = type; CountOfInitialRoll = countOfInitialRoll; CheckType = checkType; Owner = owner; if (checkType != DiceRollCheckType.Virtual) { SetDiceSpawningPoint(); } GenerateDiceRoll(); }
public DiceRoll(DiceKind type, int number, DiceRollCheckType checkType, PlayerNo playerNo = PlayerNo.PlayerNone) { Type = type; CountOfInitialRoll = number; CheckType = checkType; PlayerNo = playerNo; ModifiedBy = new List <PlayerNo>(); if (checkType != DiceRollCheckType.Virtual) { SetSpawningPoint(); } GenerateDiceRoll(); }
/// <summary> /// Starts "Roll dice to check" subphase /// </summary> public void PerformDiceCheck(string description, DiceKind diceKind, int count, Action finish, Action callback) { Phases.CurrentSubPhase.Pause(); Selection.ActiveShip = HostShip; AbilityDiceCheck subphase = Phases.StartTemporarySubPhaseNew <AbilityDiceCheck>( description, callback ); subphase.DiceKind = diceKind; subphase.DiceCount = count; subphase.AfterRoll = delegate { AfterRollWrapper(finish); }; subphase.Start(); }
public Die(DiceRoll diceRoll, DiceKind type, DieSide side = DieSide.Unknown) { ParentDiceRoll = diceRoll; Type = type; IsUncancelable = false; Sides = new List <DieSide> { DieSide.Blank, DieSide.Blank, DieSide.Focus, DieSide.Focus, DieSide.Success, DieSide.Success, DieSide.Success }; if (type == DiceKind.Attack) { Sides.Add(DieSide.Crit); } if (type == DiceKind.Defence) { Sides.Add(DieSide.Blank); } if (side != DieSide.Unknown) { Side = side; IsAddedResult = true; } else { Side = Sides[UnityEngine.Random.Range(0, 8)]; IsAddedResult = false; } }
public RollDiceAction(DiceKind diceType, AbilityPart onCrit, AbilityPart onHit) { DiceType = diceType; OnCrit = onCrit; OnHit = onHit; }
public DieResultEventArg(PlayerNo playerNo, DiceKind diceKind, DieSide dieSide) { PlayerNo = playerNo; DiceKind = diceKind; DieSide = dieSide; }
public DieRollEventArg(PlayerNo playerNo, DiceKind diceKind) { PlayerNo = playerNo; DiceKind = diceKind; }
public DiceRoll(DiceKind type, int number) { Type = type; Number = number; GenerateDiceRoll(type, number); }