private void Awake() { questGiver = FindObjectOfType <QuestGiver>(); cameraChange = FindObjectOfType <CameraChange>(); playerHealth = FindObjectOfType <PlayerHealth>(); winScript = FindObjectOfType <WinCondition>(); }
public static CampaignNode InitializeCampaign() { //Initialize Tutorial Mission Instantiators WinCondition winCon = new WinCondition(); TutorialMoneyInitialier moneyInit = new TutorialMoneyInitialier(); //Initialize Tutorial Missin Triggers WinTrigger win = new WinTrigger(); SpeakTrigger tutorial_First_Mayor = new SpeakTrigger(SpeakerType.Mayor, 1, "I will get your medicine"); SpeakTrigger tutorial_First_Shopkeeper = new SpeakTrigger(SpeakerType.ShopKeeper, 1, "Do you know where to find money?"); PickupTrigger tutorialMoneyCollection = new PickupTrigger("Money", 5); SpeakTrigger tutorial_Second_Shopkeeper = new SpeakTrigger(SpeakerType.ShopKeeper, 1, "Here is the money you asked for"); PickupTrigger pickUpMedicine = new PickupTrigger("Mayor_Medicine", 1); SpeakTrigger tutorial_Second_Mayor = new SpeakTrigger(SpeakerType.Mayor, 1, "Here is your medicine"); CampaignNode temp; CampaignNode next; //Contruct the campaign tree next = new CampaignNode(null, null, win, 7, "You Win!", winCon); temp = new CampaignNode(next, null, tutorial_Second_Mayor, 6, "Return to the Mayor to give him his medicine"); //next = temp; //temp = new CampaignNode(next, null, pickUpMedicine, 5, "Pickup Medicine from the Shopkeeper"); next = temp; temp = new CampaignNode(next, null, tutorial_Second_Shopkeeper, 4, "Return to the Shopkeeper with the money"); next = temp; temp = new CampaignNode(next, null, tutorialMoneyCollection, 3, "Collect 5 money to pay the Shopkeeper for the Mayor's medicine", moneyInit); next = temp; temp = new CampaignNode(next, null, tutorial_First_Shopkeeper, 2, "Talk to the Shopkeeper about the Mayor's medicine"); next = temp; temp = new CampaignNode(next, null, tutorial_First_Mayor, 1, "Talk to the Mayor"); return(temp); }
public static void WinConditionInspectorGUI(WinCondition win) { win.Condition = EditorGUILayout.MaskField("胜利条件", win.Condition, System.Enum.GetNames(typeof(EnumWinCondition))); if (win.Condition == 0) { win.Condition = 1; } EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(Screen.width - 16)); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); if (EnumTables.MaskFieldIdentify(win.Condition, (int)EnumWinCondition.击败指定Boss)) { win.BossID = EditorGUILayout.IntField("Boss ID", win.BossID); } if (EnumTables.MaskFieldIdentify(win.Condition, (int)EnumWinCondition.压制指定城池)) { win.CityID = EditorGUILayout.IntField("城池 ID", win.CityID); } if (EnumTables.MaskFieldIdentify(win.Condition, (int)EnumWinCondition.回合坚持)) { win.Round = EditorGUILayout.IntSlider("回合数", win.Round, 2, 50); } /*if (EnumTables.MaskFieldIdentify(win.Condition, (int)EnumWinCondition.领主地点撤离)) * { * EditorGUILayout.BeginHorizontal(); * EditorGUILayout.EndHorizontal(); * }*/ EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
private void OnTriggerEnter(Collider other) { WinCondition winCondition = other.GetComponent <WinCondition>(); DieEvent dieEvent = other.GetComponent <DieEvent>(); ICoins iCoins = other.GetComponent <ICoins>(); if (other.tag == "Cannon") { cannonTriggered = other.gameObject; other.enabled = false; StuckOnCannon(); cannonTriggered.GetComponent <CannonParent>().mAnimator.SetTrigger("Entering"); OnProgressLvl(transform.position); } else if (dieEvent != null) { mCollider.enabled = false; transform.position = reference.position; transform.eulerAngles = reference.eulerAngles; dieEvent.CharacterDie(); m_Rigidbody.constraints = RigidbodyConstraints.FreezeAll; m_SpriteRenderer.enabled = false; } else if (winCondition != null) { winCondition.Win(m_Rigidbody); mCollider.enabled = false; m_SpriteRenderer.enabled = false; } else if (iCoins != null) { iCoins.CollectCoins(); } }
private void InitSpeciesWidgetMap() { GameController game = GameController.GetInstance(); WinCondition winCondition = null; m_widgets.Clear(); m_species.Clear(); if (game != null) { winCondition = game.GetComponent <WinCondition>(); } if (winCondition == null) { return; } int speciesNum = 0; foreach (WinCondition.SpeciesComparisonExpr speciesExpr in winCondition.allOfThese) { AnimalPreset species = speciesExpr.species; if (species == null || m_widgets.ContainsKey(speciesExpr.DnaId)) { continue; } GameObject widget = Instantiate(widgetPrefab, new Vector3(0.0f, 0.0f, 1.0f), Quaternion.identity, gameObject.transform); widget.transform.localPosition = new Vector3(-29.0f + WIDGET_SIZE * speciesNum, 13.0f, 1.0f); m_widgets.Add(speciesExpr.DnaId, widget); m_species.Add(speciesExpr.DnaId, speciesExpr.species); ++speciesNum; } }
public void UpdateHud() { GameController game = GameController.GetInstance(); if (game == null || !gameObject.activeSelf) { return; } WinCondition winCond = game.GetComponent <WinCondition>(); if (winCond == null) { return; } Dictionary <int, int> animalCounters = winCond.CountAnimals(); foreach (KeyValuePair <int, GameObject> entry in m_widgets) { TextMesh textMesh = entry.Value.GetComponent <TextMesh>(); int animalCounter; animalCounters.TryGetValue(entry.Key, out animalCounter); textMesh.text = "x" + animalCounter; } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "MazeWall") { Tether tether = (Tether)GetComponent("Tether"); Debug.Log("Collision"); Color wallColor = collision.gameObject.GetComponent <Renderer>().material.color; Color playerColor = GetComponent <Renderer>().material.color + tether.GetTetherTo().GetComponent <Renderer>().material.color; Debug.Log(wallColor); playerColor = ColorClamp(playerColor); Debug.Log(GetComponent <Renderer>().material.color); if (wallColor == playerColor) { Destroy(collision.gameObject); } } if (collision.gameObject.tag == "WinDoor") { Debug.Log("Win"); WinCondition winCondition = GameObject.FindObjectOfType(typeof(WinCondition)) as WinCondition; winCondition.Win(); } }
// Make instance a singleton void Awake() { if (instance != null) { Destroy(instance); } instance = this; mainCanvas = GameObject.Find("Canvas").GetComponent <Canvas>(); if (RandomiseCondition) { CurrentLevelWinCondition = (ConditionType)UnityEngine.Random.Range(1, 4); if (CurrentLevelWinCondition != ConditionType.ProfitLimitedInventory) { TotalShipCount = 30; } } GameManager.Invinciblate(CurrentLevelWinCondition == ConditionType.Profit); if (CurrentLevelWinCondition == ConditionType.ProfitByCustomer) { GameManager.CountCustomers(TotalCustomerNumber); } }
void OnDestroy() { if (instance == this) { instance = null; } }
void Start() { int i = Random.Range(0, 2); transform.Rotate(0, 0, RandomAngles[i]); CanvOfWin = GameObject.Find("background").GetComponent <WinCondition>(); }
public override void ResetValues() { base.ResetValues(); sizeX = 0; sizeY = 0; mapSprite = null; mapDescription = ""; winCondition = WinCondition.ROUT; loseCondition = LoseCondition.NONE; turnLimit = 0; skipBattlePrep = false; preDialogue = null; introDialogue = null; endDialogue = null; mapMusic = null; spawnPoints1 = new List <Position>(); spawnPoints2 = new List <Position>(); forcedCharacters = new List <CharEntry>(); lockedCharacters = new List <CharEntry>(); enemies = new List <SpawnData>(); allies = new List <SpawnData>(); reinforcements = new List <SpawnData>(); interactions = new List <InteractPosition>(); triggerIds = new List <TriggerTuple>(); triggerAreas = new List <TriggerArea>(); turnEvents = new List <TurnEvent>(); }
// Use this for initialization void Start() { _heroController = GameObject.Find("Hero").GetComponent <HeroController>(); _winCondition = GameObject.Find("GameManager").GetComponent <WinCondition>(); rangeCollider2D = GetComponent <CircleCollider2D>(); rangeCollider2D.radius = pickupRadius; }
void Awake() { // Setting up the references. winCondition = GetComponentInParent <WinCondition>(); ren = transform.Find("body").GetComponent <SpriteRenderer>(); frontCheck = transform.Find("frontCheck").transform; }
private void Awake() { Instance = this; photonView = PhotonView.Get(this); PhotonPeer.RegisterType(typeof(Analytics), (byte)'B', SerializedAnalytics.Serialize, SerializedAnalytics.Deserialize); InitMyAnalytics(); }
// Use this for initialization void Start() { isPaused = false; winCondition = GetComponent <WinCondition>(); winCondition.OnRoundComplete += OnRoundCompleteHandler; audioSource = GetComponent <AudioSource>(); gameMusic = gameSongObject.GetComponent <AudioSource>(); }
// Use this for initialization void Start() { _winCondition = GameObject.Find("GameManager").GetComponent <WinCondition>(); Invoke("initItems", 1); InvokeRepeating("dropItem", 8, 1); droppedItem = false; spawnPoints = itemspawns.GetComponentsInChildren <Transform>(); }
void LoadLevel() { currentLevelScriptableObject = levels[level]; cam.backgroundColor = currentLevelScriptableObject.cameraBgColor; GameObject player = Instantiate(currentLevelScriptableObject.levelPrefab, spawnPos, Quaternion.identity); player.transform.parent = levelElements.transform; winCondition = currentLevelScriptableObject.winCondition; }
public WinCondition CalculateHighestWin() { WinCondition highestWin = WinCondition.NoWin; int[] flushes = new int[Enum.GetValues(typeof(Suit)).Length]; int straightCount = 1; int firstPairIndex = -1, secondPairIndex = -1; IList <Card> cards = Hand.ToList(); for (int i = 0; i < cards.Count; i++) { // Bump the flush count for each suit card found. flushes[(int)cards[i].Suit]++; // Bump the straightCount if we're one more than the last card if (i > 0 && cards[i].Face == cards[i - 1].Face + 1) { straightCount++; } // List is sorted, so pairs are next to each other. if (i > 0 && firstPairIndex == -1 && cards[i].Face == cards[i - 1].Face) { firstPairIndex = i; if (WinCondition.Pair > highestWin) { highestWin = WinCondition.Pair; } } // Only look for second pair after the first pair if (firstPairIndex != -1 && secondPairIndex == -1 && i > (firstPairIndex + 1) && cards[i].Face == cards[i - 1].Face) { secondPairIndex = i; if (WinCondition.TwoPair > highestWin) { highestWin = WinCondition.TwoPair; } } } if (straightCount == Hand.Count) { if (WinCondition.Straight > highestWin) { highestWin = WinCondition.Straight; } } if (flushes.Any(f => f == Hand.Count)) { if (WinCondition.Flush > highestWin) { highestWin = WinCondition.Flush; } } return(highestWin); }
public void OnDispatchHelicopter() { //calledLocation = playerScript.transform; Debug.Log("Helicopter called"); calledLocation = GameObject.FindGameObjectWithTag("Finish").transform; flareWin = GameObject.FindGameObjectWithTag("GameController").GetComponent <WinCondition>(); aboveTarget = new Vector3(calledLocation.position.x, calledLocation.position.y + 150f, calledLocation.position.z); called = true; }
public void RemoveCondition(WinCondition condition) { foreach (var item in ConditionInfos.ToArray()) { if (item.condition == condition) { StartRemovingConditionInfo(item); } } }
public bool CheckWinCondition(WinCondition condition) { switch (condition) { case WinCondition.Bavarian: if (centralGroup.GetTotalPower() >= 35) { return(true); } break; case WinCondition.Bermuda: if (centralGroup.GetTotalAlignments().Count >= 10) { return(true); } break; case WinCondition.Discordian: if (centralGroup.GetTotalAlignments(Alignment.Weird) >= 5) { return(true); } break; case WinCondition.Gnomes: if (centralGroup.GetTotalTreasury() >= 150) { return(true); } break; case WinCondition.Network: if (centralGroup.GetTotalTransferablePower() >= 25) { return(true); } break; case WinCondition.Servants: if (centralGroup.GetTotalGroupsDestroyed() > 8) { return(true); } break; case WinCondition.Assassins: if (centralGroup.GetTotalAlignments(Alignment.Violent) >= 6) { return(true); } break; } return(false); }
public void AddCondition(WinCondition condition) { ConditionInfo info = new ConditionInfo(); info.condition = condition; info.conditionUI = GameUI.Instance.AddUICondition(); info.UpdateUI(); ConditionInfos.Add(info); info.conditionUI.SetPositionIndex(ConditionInfos.Count); }
public bool ContainsCondition(WinCondition condition) { foreach (var con in ConditionInfos) { if (con.condition == condition) { return(true); } } return(false); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void Awake() { if (!singleton) { singleton = this; } else { singleton = this; Debug.LogWarning("Too many WinConditionObjects", gameObject); } }
public void AddCondition(WinCondition condition) { ConditionInfo info = new ConditionInfo(); info.condition = condition; //TODO create conditionUIobject somewhere //info.conditionUI = GameUI.Instance.AddUICondition(); info.UpdateUI(); ConditionInfos.Add(info); info.conditionUI.SetPositionIndex(ConditionInfos.Count); }
public void SpawnEnemy(string name, int skill, int stamina, EnemyType type, string nextScene) { var enemy = new Enemy(name, skill, stamina, type); var winCondition = new WinCondition(nextScene); enemy.CombatConditions.Add(winCondition); CurrentScene.Enemies.Add(enemy); }
public Settings(ulong matchId, string roomName, string historyUrl, long currentBeatmapId, TeamMode teamMode, WinCondition winCondition, long mods) { MatchId = matchId; RoomName = roomName; HistoryUrl = historyUrl; CurrentBeatmapId = currentBeatmapId; TeamMode = teamMode; WinCondition = winCondition; Mods = mods; }
private void Start() { timer.isNewGameTime = true; randomize = GetComponent <Randomize>(); ranks = GetComponent <Ranks>(); stateMachine = GetComponent <StateMachine>(); aiController = GetComponent <AIController>(); winCondition = GetComponent <WinCondition>(); textHandler = GetComponent <TextHandler>(); timer.newGameTime = 10; dontDestroyOnLoadObjects = GameObject.Find("DontDestroyOnLoadObjects"); }
//コンストラクタ public Stage(Chapter chapter, bool isUnitSelectRequired, int entryUnitCount, List <Coordinate> entryUnitCoordinates, List <Enemy> enemyList, WinCondition winCondition, LoseCondition loseCondition, string storyText, bool isReimuRoute, List <TreasureBox> treasureList) { this.chapter = chapter; this.isUnitSelectRequired = isUnitSelectRequired; this.entryUnitCount = entryUnitCount; this.entryUnitCoordinates = entryUnitCoordinates; this.winCondition = winCondition; this.loseCondition = loseCondition; this.storyText = storyText; this.isReimuRoute = isReimuRoute; this.enemyList = enemyList; this.treasureList = treasureList; }
//Constructor public Quest(string name, string objective, string description, Vector2 start, Player player, WinCondition winCondition, int reward = 1, int cashReward = 10) { this.name = name; this.objective = objective; this.description = description; this.startPoint = start; this.Reward = reward; this.CashReward = cashReward; this.player = player; this.worldManager = Game1.Instance.worldManager; this.winCondition = winCondition; entitites = new List<Entity.Entity>(); status = 0; entitiesLoaded = false; }
/// <summary> /// Constructor. /// </summary> public OptionsMenuScreen() : base("Options") { wc = WinCondition.Score; // Create our menu entries. p1Class = new MenuEntry(string.Empty); p2Class = new MenuEntry(string.Empty); time = new MenuEntry(string.Empty); maxScore = new MenuEntry(string.Empty); condition = new MenuEntry(string.Empty); p1Power = new MenuEntry(string.Empty); p2Power = new MenuEntry(string.Empty); resolution = new MenuEntry(string.Empty); start = new MenuEntry("Start Game"); back = new MenuEntry("Back"); SetMenuEntryText(); MenuEntry backMenuEntry = new MenuEntry("Back"); // Hook up menu event handlers. start.Selected += startSelected; p1Class.Selected += p1ClassSelected; p1Class.Reversed += p1ClassDown; p2Class.Selected += p2ClassSelected; p2Class.Reversed += p2ClassDown; p1Power.Selected += p1PowerUp; p1Power.Reversed += p1PowerDown; p2Power.Selected += p2PowerUp; p2Power.Reversed += p2PowerDown; maxScore.Selected += maxScoreSelected; maxScore.Reversed += scoreDown; time.Selected += timeUp; time.Reversed += timeDown; condition.Selected += ConditionSelected; condition.Reversed += ConditionSelected; resolution.Selected += ResolutionUp; resolution.Reversed += ResolutionDown; back.Selected += toMainMenu; // Add entries to the menu. MenuEntries.Add(start); MenuEntries.Add(p1Class); MenuEntries.Add(p2Class); MenuEntries.Add(p1Power); MenuEntries.Add(p2Power); #if !XBOX MenuEntries.Add(resolution); #endif MenuEntries.Add(condition); MenuEntries.Add(maxScore); MenuEntries.Add(back); }
private void assignWinCondition(string gameObjectName) { winCondition = GameObject.Find(gameObjectName).GetComponent<WinCondition>(); }
//Constructor public Storyline(string name, string objective, string description, Vector2 StartPoint, Player player, WorldManager worldManager, WinCondition winCondition, int reward = 0, int cashReward = 0) : base(name, objective, description, StartPoint, player, winCondition, reward, cashReward) { quests = new List<Quest>(); }
/// <summary> /// Event handler for when the Ungulate menu entry is selected. /// </summary> void ConditionSelected(object sender, EventArgs e) { if (wc == WinCondition.Score) { MenuEntries.Remove(maxScore); MenuEntries.Remove(back); MenuEntries.Add(time); MenuEntries.Add(back); wc = WinCondition.Time; } else if (wc == WinCondition.Time) { MenuEntries.Remove(time); MenuEntries.Remove(back); MenuEntries.Add(maxScore); MenuEntries.Add(back); wc = WinCondition.Score; } SetMenuEntryText(); }
// Use this for initialization void Start() { GameObject obj = GameObject.Find("WinCondition"); winScript = (WinCondition)obj.GetComponent(typeof(WinCondition)); }
// Use this for initialization void Start() { win = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<WinCondition>(); }