//listener on button public void PickTeamCat(TeamSelector chosen) { GameControl.control.getSoundManager().playButton(); currentChosen = chosen; GameControl.control.getMainUI().deck.transform.parent.gameObject.SetActive(true); gameObject.SetActive(false); }
static Rule CreateRuleFromContext(DeltinScriptParser.Ow_ruleContext ruleContext) { string ruleName = ruleContext.STRINGLITERAL().GetText(); ruleName = ruleName.Substring(1, ruleName.Length - 2); RuleEvent ruleEvent = RuleEvent.Ongoing_Global; TeamSelector team = TeamSelector.All; PlayerSelector player = PlayerSelector.All; { var additionalArgs = ruleContext.expr(); foreach (var arg in additionalArgs) { string type = arg.GetText().Split('.').ElementAtOrDefault(0); string name = arg.GetText().Split('.').ElementAtOrDefault(1); if (type == "Event") { if (Enum.TryParse(name, out RuleEvent setEvent)) { ruleEvent = setEvent; } else { throw new SyntaxErrorException($"Unknown event type \"{arg.GetText()}\".", arg.start); } } else if (type == "Team") { if (Enum.TryParse(name, out TeamSelector setTeam)) { team = setTeam; } else { throw new SyntaxErrorException($"Unknown team type \"{arg.GetText()}\".", arg.start); } } else if (type == "Player") { if (Enum.TryParse(name, out PlayerSelector setPlayer)) { player = setPlayer; } else { throw new SyntaxErrorException($"Unknown player type \"{arg.GetText()}\".", arg.start); } } else { throw new SyntaxErrorException($"Unknown rule argument \"{arg.GetText()}\".", arg.start); } } } return(new Rule(ruleName, ruleEvent, team, player)); }
void Start() { instance = this; StartCoroutine(SpawnBonusLoop()); playerLogos[0].material.mainTexture = TeamSelector.GetSelection(0).GetLogo(); playerLogos[1].material.mainTexture = TeamSelector.GetSelection(1).GetLogo(); }
private void UpdateLogos() { teamLogosUI[0].texture = TeamSelector.GetSelection(0).GetLogo(); teamLogosUI[1].texture = TeamSelector.GetSelection(1).GetLogo(); playerLogos[0].material.mainTexture = TeamSelector.GetSelection(0).GetLogo(); playerLogos[1].material.mainTexture = TeamSelector.GetSelection(1).GetLogo(); teamNames[0].text = TeamSelector.GetSelection(0).GetName(); teamNames[1].text = TeamSelector.GetSelection(1).GetName(); }
private void endGame() { gameEnd = true; int winningTeam = Bscore >= goalsToWin ? 0 : 1; TextMesh winText = GameObject.Find("Win Text").GetComponent <TextMesh>(); winText.GetComponent <MeshRenderer>().enabled = true; winText.text = "C'est\n" + TeamSelector.GetSelection(winningTeam).GetName() + "\nle plu for"; }
public RuleNode(string name, RuleEvent eventType, TeamSelector team, PlayerSelector player, IExpressionNode[] conditions, BlockNode block, Range eventRange, Range teamRange, Range playerRange, Range range) : base(range, eventRange, teamRange, playerRange) { Name = name; Event = eventType; Team = team; Player = player; Conditions = conditions; Block = block; }
public Rule(string name, RuleEvent ruleEvent, TeamSelector team, PlayerSelector player) // Creates a rule. { if (name.Length > Constants.RULE_NAME_MAX_LENGTH) { throw new ArgumentOutOfRangeException(nameof(name), name, $"Rule names cannot be longer than {Constants.RULE_NAME_MAX_LENGTH} characters."); } Name = name; RuleEvent = ruleEvent; Team = team; Player = player; IsGlobal = ruleEvent == RuleEvent.OngoingGlobal; }
void Awake() { GameObject t1Panel = GameObject.Find("Team1Panel"); team1Name = t1Panel.transform.FindChild("TeamName").GetComponent <Text>(); team1Sprite = t1Panel.transform.FindChild("TeamSprite").GetComponent <Image>(); GameObject t2Panel = GameObject.Find("Team2Panel"); team2Name = t2Panel.transform.FindChild("TeamName").GetComponent <Text>(); team2Sprite = t2Panel.transform.FindChild("TeamSprite").GetComponent <Image>(); teamSelector = GameObject.FindObjectOfType <TeamSelector>(); }
public static void AbstractFactoryDemo() { ISoldierFactory Team1 = TeamSelector.GetInstance().GetTeam(TeamColour.Blue); ISoldierFactory Team2 = TeamSelector.GetInstance().GetTeam(TeamColour.Red); Console.WriteLine("The First Team!"); Team1.CreateAssault().FastShot(); Team1.CreateHeavy().LaunchRocket(); Team1.CreateSniper().AimShot(); Console.WriteLine("---------------------------------"); Console.WriteLine("The second Team!"); Team2.CreateAssault().FastShot(); Team2.CreateHeavy().LaunchRocket(); Team2.CreateSniper().AimShot(); }
public override Node VisitOw_rule(DeltinScriptParser.Ow_ruleContext context) { string name = context.STRINGLITERAL().GetText().Trim('"'); BlockNode block = (BlockNode)VisitBlock(context.block()); IExpressionNode[] conditions = new IExpressionNode[context.rule_if()?.expr().Length ?? 0]; Range[] conditionRanges = new Range[context.rule_if()?.expr().Length ?? 0]; for (int i = 0; i < conditions.Length; i++) { conditions[i] = (IExpressionNode)VisitExpr(context.rule_if().expr()[i]); conditionRanges[i] = Range.GetRange(context.rule_if().expr()[i]); } RuleEvent eventType = RuleEvent.OngoingGlobal; TeamSelector team = TeamSelector.All; PlayerSelector player = PlayerSelector.All; Range eventRange = null; Range teamRange = null; Range playerRange = null; foreach (var ruleOption in context.rule_option()) { string option = ruleOption.PART(0).GetText(); Range optionRange = Range.GetRange(ruleOption.PART(0).Symbol); string value = null; Range valueRange = null; if (ruleOption.PART().Length == 2) { value = ruleOption.PART(1).GetText(); valueRange = Range.GetRange(ruleOption.PART(1).Symbol); } switch (option) { case "Event": if (!Enum.TryParse <RuleEvent>(value, out eventType)) { _diagnostics.Add(new Diagnostic($"{value} is not a valid Event type.", valueRange)); } eventRange = Range.GetRange(ruleOption); break; case "Team": if (!Enum.TryParse <TeamSelector>(value, out team)) { _diagnostics.Add(new Diagnostic($"{value} is not a valid Team type.", valueRange)); } teamRange = Range.GetRange(ruleOption); break; case "Player": if (!Enum.TryParse <PlayerSelector>(value, out player)) { _diagnostics.Add(new Diagnostic($"{value} is not a valid Player type.", valueRange)); } playerRange = Range.GetRange(ruleOption); break; default: _diagnostics.Add(new Diagnostic($"{value} is not a valid rule option.", optionRange)); break; } } var node = new RuleNode(name, eventType, team, player, conditions, block, eventRange, teamRange, playerRange, Range.GetRange(context)); CheckRange(node); return(node); }
// Start is called before the first frame update void Start() { int idPlayer = Random.Range(0, 2); transform.GetChild(0).Find("Logo").GetComponent <MeshRenderer>().material.mainTexture = TeamSelector.GetSelection(idPlayer).GetLogo(); transform.GetChild(0).Find("Spectator").GetComponent <MeshRenderer>().material = colors[idPlayer]; }
private void Start() { body = GetComponent <Rigidbody>(); startPos = transform.position; startAngle = transform.eulerAngles.y; horizontalAxis = "Horizontal" + playerID; verticalAxis = "Vertical" + playerID; dashButton = "Dash" + playerID; transform.GetChild(0).Find("Logo").GetComponent <MeshRenderer>().material.mainTexture = TeamSelector.GetSelection(playerID - 1).GetLogo(); }
private void OnTeamSelectorStateChanged(TeamSelector teamSelector) { buttonNext.enabled = AreSettingsEligible(); }