void Start() { wc = FindObjectOfType <WinController>(); anime = GetComponent <Animator>(); instructions.SetActive(false); AS = GetComponent <AudioSource>(); }
void Start() { if (winController == null) { winController = FindObjectOfType <WinController>(); } }
private PieceDestinationController CreatePieceDestinationController(WinController winController) { PieceTranslationController pieceTranslationController = CreatePieceTranslationController(); GridItemMover slotGridItemMover = SlotGridItemMover(); return(new PieceDestinationControllerImplementation(pieceTranslationController, slotGridItemMover, winController)); }
// Update is called once per frame void Update() { if (wc == null) { wc = FindObjectOfType <WinController>(); } // update our position to the mouse point Vector2 cameraPos = camera.ScreenToWorldPoint(Input.mousePosition); transform.position = new Vector3(cameraPos.x, cameraPos.y, 0); // Logic to shoot when we click if (Input.GetKeyDown(KeyCode.Mouse0)) { AS.Play(); killAll(targetsInSight); StartCoroutine(flash(new Color[] { Color.yellow, Color.red })); } if (score <= -2) { wc.SetLose(); } else if (score >= 90) { AS2.Play(); wc.SetWin(); } }
void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); scoreDisplay.text = score + "pts"; wc = FindObjectOfType <WinController>(); AS = GetComponent <AudioSource>(); }
public void UpdateScore(int cash, WinController shipCounter) { //Debug.LogFormat("Update score stats"); _totalScore.text = string.Format("Cash ${0}", cash.ToString()); //FerryScore.text = string.Format("{0} / {1}", currentScore.FerryCount, targetScore.FerryCount); //FreighterScore.text = string.Format("{0} / {1}", currentScore.FreighterCount, targetScore.FreighterCount); //KeelboatScore.text = string.Format("{0} / {1}", currentScore.KeelboatCount, targetScore.KeelboatCount); //MotorboatScore.text = string.Format("{0} / {1}", currentScore.MotorboatCount, targetScore.MotorboatCount); float currentHeight = 0.0f; for (int i = 0; i < shipCounter.ShipCounterCount; ++i) { _shipTypeGUIInfos[i].rectTransform.gameObject.SetActive(true); _shipTypeGUIInfos[i].rectTransform.anchoredPosition = new Vector2(0.0f, currentHeight); currentHeight -= _shipTypeGUIInfos[i].rectTransform.sizeDelta.y; _shipTypeGUIInfos[i].UpdateScore(shipCounter.CurrentWinCondition, shipCounter.ShipTypeCounters[i].counter, shipCounter.ShipTypeCounters[i].goal); //if(shipCounter.ShipTypeCounters[i].goal > 0) //{ // _shipTypeGUIInfos[i].rectTransform.gameObject.SetActive(true); // _shipTypeGUIInfos[i].rectTransform.anchoredPosition = new Vector2(0.0f,currentHeight); // currentHeight -= _shipTypeGUIInfos[i].rectTransform.sizeDelta.y; // _shipTypeGUIInfos[i].UpdateScore(shipCounter.CurrentWinCondition, shipCounter.ShipTypeCounters[i].counter, shipCounter.ShipTypeCounters[i].goal); // } else { // _shipTypeGUIInfos[i].rectTransform.gameObject.SetActive(false); //} } }
void Awake() { if (!winController) { GameObject obj = GameObject.Find("WinHandler"); winController = obj.GetComponent<WinController>(); } }
void Update() { if (wc == null) { wc = FindObjectOfType <WinController>(); } // Check for user input if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Mouse0)) { health--; if (health <= 0) { // WE WON AS.Play(); wc.SetWin(); } else { // StartCoroutine(flash(Color.red)); } // If our health has dropped below a damage threshhold if (health % damagePerState == damagePerState - 1 && health != (damagePerState * damageStates.Length) - 1) { // Go ahead and update the sprite to the next damageState Debug.Log("We crossed a state with health:" + health + " the new state is:" + health / damagePerState); spriteRenderer.sprite = damageStates[health / damagePerState]; } } }
void Update() { if (wc == null) { wc = FindObjectOfType <WinController>(); } if (!wc.isAnimating) { bool click = Input.GetKey(KeyCode.Mouse0) || Input.GetKey(KeyCode.E); if (canStartDialogue && !choicesOpen && !isDone && click && lastClick != click) { if (!dialogueOpen) { lady.SetActive(true); nameBox.SetActive(true); nameTxtBox.gameObject.SetActive(true); dialogueBox.SetActive(true); dialogueTextBox.gameObject.SetActive(true); foreach (Button button in choiceButtons) { button.gameObject.SetActive(false); } dialogueOpen = true; FindObjectOfType <Player_SideScroll>().canMove = false; } PrintDialogueToString(); } lastClick = click; } }
// Update is called once per frame void Update() { if (wc == null) { wc = FindObjectOfType <WinController>(); } if (playerInRange == true && Input.GetKeyDown(KeyCode.E)) { ispraying = true; AS.Play(); } if (ispraying == true) { player.anim.SetBool("pray", true); player.GetComponent <Player_SideScroll>().enabled = false; timer += Time.deltaTime; anime = GetComponent <Animator>(); anime.SetBool("startPraying", true); if (timer >= PrayerTime) { Debug.Log("PLAYERWIN GOES HERE"); wc.SetWin(); } if (Input.anyKey) { } } }
// Update is called once per frame void Update() { if (wc == null) { wc = FindObjectOfType <WinController>(); } transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 4)); bool click = Input.GetKey(KeyCode.Mouse0); if (!didbranding && click && lastClick != click) { if (goodBounds.bounds.Contains(spawnpoint.transform.position)) { GameObject stamp = Instantiate(stampPrefab); stamp.transform.position = spawnpoint.transform.position; lastClick = click; didbranding = true; StartCoroutine(WaitToWin()); } else if (allBounds.bounds.Contains(spawnpoint.transform.position)) { GameObject stamp = Instantiate(stampPrefab); stamp.transform.position = spawnpoint.transform.position; lastClick = click; wc.SetLose(); } } }
private GameObject CreateSlotObject(WinController winController) { StubNullItemNeighborRetriever itemNeighborRetriever = new StubNullItemNeighborRetriever(); GridItemFactory slotFactory = CreateGridItemFactory(itemNeighborRetriever, winController); GameObject slotObject = slotFactory.Create(); return(slotObject); }
private PieceDestinationController CreateSlot(WinController winController, int placeInGrid, int row, int column) { GameObject slotObject = CreateSlotObject(winController); slotObject.GetComponent <GridItemMover>().SetupRownAndColumn(placeInGrid, row, column); return(slotObject.GetComponent <PieceDestinationController>()); }
void Awake() { if (!winController) { GameObject obj = GameObject.Find("WinHandler"); winController = obj.GetComponent <WinController>(); } }
void OnValidate() { if (_winController == null) { _winController = new WinController(); } _winController.Validate(); }
void Start() { // Set our initial variables spriteRenderer = GetComponent <SpriteRenderer>(); health = damagePerState * damageStates.Length; spriteRenderer.sprite = damageStates[damageStates.Length - 1]; wc = FindObjectOfType <WinController>(); AS = GetComponent <AudioSource>(); }
void Start() { playerInRange = false; timer = 0; ispraying = false; wc = FindObjectOfType <WinController>(); buttonprompoty.SetActive(false); AS = GetComponent <AudioSource>(); }
private void WinStart(string action) { WinController wc = new WinController(); switch (action) { case "index": wc.actionIndex(); break; } }
public void AddCorrectlyPositionedPiece() { List <PiecePlaceInGrid> correctlyPositionedPieces = CreateCorrectPositionedPieceList(); WinController winController = CreateWinController(correctlyPositionedPieces); PiecePlaceInGrid piece = CreatePiecePlaceInGrid(); winController.AddCorrectlyPositionedPiece(piece); Assert.Contains(piece, correctlyPositionedPieces); }
public PieceDestinationControllerImplementation(PieceTranslationController pieceTranslationController, GridItemMover slotGridItemMover, WinController winController) { this.pieceTranslationController = pieceTranslationController; this.slotGridItemMover = slotGridItemMover; this.winController = winController; //this.grid = grid; NULL_TRANSLATION_CONTROLLER = new NullPieceTranslationController(); EMPTY_STATE = new EmptyState(); MOVABLE_STATE = new MovableState(); FIXED_STATE = new FixedState(); SetFixed(); }
// Update is called once per frame void Update() { if (winController == null) { winController = FindObjectOfType <WinController>(); } if (Input.GetKeyUp(KeyCode.K)) { winController.SetWin(); } }
// Start is called before the first frame update void Start() { if ((PlayerPrefs.HasKey("Xball"))) { gameObject.transform.position = new Vector3(PlayerPrefs.GetFloat("Xball"), 0.5f, PlayerPrefs.GetFloat("Zball")); gameObject.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); } Handf = FindObjectOfType <Handforce>(); ballrb = GetComponent <Rigidbody>(); Winct = FindObjectOfType <WinController>(); // ballstart = (int)gameObject.transform.rotation.x; ballmove = false; }
void Awake() { if (WC == null) { WC = this; } else if (WC != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public SlotFactoryImplementation(GameObject gridItemObjectPrefab, SlotSelection slotSelection, GridItemFactory pieceFactory, ItemNeighborRetriever itemNeighborRetriever, WinController winController) { this.gridItemObjectPrefab = gridItemObjectPrefab; this.slotSelection = slotSelection; this.pieceFactory = pieceFactory; this.itemNeighborRetriever = itemNeighborRetriever; this.winController = winController; GridItem gridItem = gridItemObjectPrefab.GetComponent <GridItem>(); GridItemWidthInUnit = gridItem.WidthInUnit; GridItemHeightInUnit = gridItem.HeightInUnit; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public void WhenNotAllPiecesAreInCorretPlaceWinEventIsNotTriggered() { int maximumPiecesToPlace = 2; List <PiecePlaceInGrid> correctlyPositionedPieces = CreateCorrectPositionedPieceList(); WinEventController winEventController = CreateWinEventController(); WinController winController = CreateWinController(correctlyPositionedPieces, winEventController, maximumPiecesToPlace); PiecePlaceInGrid firstPiece = CreatePiecePlaceInGrid(); bool wasEventTriggered = false; winEventController.AddListener(() => wasEventTriggered = true); winController.AddCorrectlyPositionedPiece(firstPiece); Assert.IsFalse(wasEventTriggered); }
void Update() { if (wc == null) { wc = FindObjectOfType <WinController>(); } if (!wc.isAnimating) { timeElapsed += Time.deltaTime; timerBar.rectTransform.sizeDelta = new Vector2(maxwidth * (timerLength - timeElapsed) / timerLength, height); if (timeElapsed > timerLength) { wc.SetLose(); } } }
// Update is called once per frame void Update() { if (wc == null) { wc = FindObjectOfType <WinController>(); } //Debug.Log(Input.mousePosition); //transform.position = Vector2.Lerp(transform.position, camera.ScreenToWorldPoint(Input.mousePosition), speed*Time.deltaTime); Vector2 cameraPos = camera.ScreenToWorldPoint(Input.mousePosition); transform.position = new Vector3(cameraPos.x, cameraPos.y, 0); // If we have 10 soup we win if (soupCollected >= 10) { wc.SetWin(); } }
private UnitCombatSystem GetNextActiveUnit(UnitCombatSystem.Team team) { if (team == UnitCombatSystem.Team.Left) { _lefTeamActiveUnitIndex = (_lefTeamActiveUnitIndex + 1) % leftTeam.Count; _unitStatsControllerUI.HidePanelPlayerPanel(UnitCombatSystem.Team.Left, GameModeEnum.Game); _unitStatsControllerUI.ViewActiveUnitInGame(leftTeam[_lefTeamActiveUnitIndex].GetUnitStats(), UnitCombatSystem.Team.Left); if (leftTeam.Count(x => x != null) == 0) { WinController.Win(false); } if (leftTeam[_lefTeamActiveUnitIndex] == null || leftTeam[_lefTeamActiveUnitIndex].IsDead()) { return(GetNextActiveUnit(team)); } if (leftTeam[_lefTeamActiveUnitIndex] == null) { return(GetNextActiveUnit(team)); } return(leftTeam[_lefTeamActiveUnitIndex]); } if (rightTeam.Count(x => x != null) == 0) { WinController.Win(true); } _rightTeamActiveUnitIndex = (_rightTeamActiveUnitIndex + 1) % rightTeam.Count; _unitStatsControllerUI.HidePanelPlayerPanel(UnitCombatSystem.Team.Right, GameModeEnum.Game); _unitStatsControllerUI.ViewActiveUnitInGame(rightTeam[_rightTeamActiveUnitIndex].GetUnitStats(), UnitCombatSystem.Team.Right); if (rightTeam[_rightTeamActiveUnitIndex] == null || rightTeam[_rightTeamActiveUnitIndex].IsDead()) { return(GetNextActiveUnit(team)); } return(rightTeam[_rightTeamActiveUnitIndex]); }
private void CheckChange(GameObject selectGirl) { var minCount = girlCount.Values.Min(); if (minCount >= girlCount[selectGirl.name]) { var uniqueCount = girlCount.Values.Count(g => g == minCount); if (uniqueCount > 1) //две и более девушки в меньшинстве { LaunchGirl(selectGirl.name); LaunchGirl(); SoundManager.Instance.PlayHello(); selectGirl.GetComponent <GirlController>().TurnRound(); UpdateCounter(); } else //самая неповторимая! { Debug.LogFormat("win! :)"); SoundManager.Instance.PlayYeah(); foreach (var girl in FindObjectsOfType <GirlController>()) { girl.gameObject.SetActive(false); } selectGirl.SetActive(true); isWin = true; return; } } else if (minCount < girlCount[selectGirl.name]) //это не меньшинство { LaunchGirl(); SoundManager.Instance.PlayHello(); UpdateCounter(); } if (girlCount.Values.Sum() >= maxGirl) //девушек стало слишком ного - начинаем заново! { WinController.LoseGame(); } }
// Update is called once per frame void Update() { if (flag == 0) { if (HPController.HP == 0) { Debug.Log("Player 1 WIN"); WinController.WinnerDecider1(); StartCoroutine(Back()); flag++; } else if (HPController2.HP == 0) { Debug.Log("Player 2 WIN"); WinController.WinnerDecider2(); StartCoroutine(Back()); flag++; } } }