// Start is called before the first frame update void Start() { _mainSceneManager = GameObject.Find("MainSceneManager").GetComponent <MainSceneManager>(); _canvasMain = GameObject.Find("CanvasMain").GetComponent <CanvasMain>(); _audioSources = GetComponents <AudioSource>(); }
public void die() { if (!canDie) { return; } MainSceneManager mainSceneManager = MainSceneManager.getMainSceneManager(); if (mainSceneManager.loseLife()) { Vector3 pos = transform.position; pos.y = 5; transform.position = pos; Rigidbody2D rb2d = GetComponent <Rigidbody2D>(); Vector3 vel = rb2d.velocity; vel.x = 0; vel.y = 0; vel.z = 0; rb2d.velocity = vel; StartCoroutine(makeInvincibleTemp()); } // Destroy(gameObject); }
public void OnObjectPlaced(ObjectPlacedEvent evt) { if (evt.effect != null) { if (IsPositionInSeason(evt.placedObject.transform.position)) { // Check whether the object being placed came from a different scene than this one if (evt.placedObject.scene != this.gameObject.scene) { // Save the name of the scene the object came from var previousScene = evt.placedObject.scene.name; var previousSeason = MainSceneManager.SceneNameToSeasonName(previousScene); // If it came from a different scene, we have to move it to this scene first. SeasonalEffect effect = evt.placedObject.GetComponentInSelfOrImmediateParent <SeasonalEffect>(); SceneManager.MoveGameObjectToScene(effect.gameObject, this.gameObject.scene); var coord = SeasonCoordinateManager.GlobalToSeasonCoordinate(evt.placedObject.transform.position); // We add the name of the previous season to the ObjectPlacedInSeasonStartEvent so that the object // originally in this season can move there (essentially swapping itself with the placed object). // This ensures that there is always one copy of the object for each season. EventManager.FireEvent(new ObjectPlacedInSeasonStartEvent(evt.placedObject, evt.effect, coord, this.seasonName, previousSeason)); } else { // This object came from within this scene, so all we have to do is update its position and fire // a ObjectPlacedInSeasonStartEvent var coord = SeasonCoordinateManager.GlobalToSeasonCoordinate(evt.placedObject.transform.position); EventManager.FireEvent(new ObjectPlacedInSeasonStartEvent(evt.placedObject, evt.effect, coord, this.seasonName)); } } } }
void Start() { sceneManager = GameObject.FindObjectOfType <MainSceneManager>(); progressText.text = sceneManager.Progress + "%"; progressText.GetComponent <TextFade>().FadeIn(0.5f); }
// Start is called before the first frame update void Start() { _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); _mainSceneManager = GameObject.Find("MainSceneManager").GetComponent <MainSceneManager>(); _mainGameStateManager = GameObject.Find("MainGameStateManager").GetComponent <MainGameStateManager>(); for (int i = 0; i < 9; i++) { _textMeshProsBestScoreNumbers[i] = gameObjectsTextMeshProsBestScoreNumbers[i].GetComponent <TextMeshProUGUI>(); _textMeshProsYourScoreNumbers[i] = gameObjectsTextMeshProsYourScoreNumbers[i].GetComponent <TextMeshProUGUI>(); } for (int i = 0; i < 8; i++) { _textMeshProsRank[i] = gameObjectsTextMeshProsRank[i].GetComponent <TextMeshProUGUI>(); _textMeshProsName[i] = gameObjectsTextMeshProsName[i].GetComponent <TextMeshProUGUI>(); _textMeshProsScore[i] = gameObjectsTextMeshProsScore[i].GetComponent <TextMeshProUGUI>(); _textMeshProsDate[i] = gameObjectsTextMeshProsDate[i].GetComponent <TextMeshProUGUI>(); } _textMeshProMessage = gameObjectTextMehProMessage.GetComponent <TextMeshProUGUI>(); _inputFieldName = gameObjectInputFieldName.GetComponent <TMP_InputField>(); _imageButtonClose = gameObjectImageButtonClose.GetComponent <Image>(); _imageButtonSend = gameObjectImageButtonSend.GetComponent <Image>(); _imageButtonArrowLeft = gameObjectImageButtonArrowLeft.GetComponent <Image>(); _imageButtonArrowRight = gameObjectImageButtonArrowRight.GetComponent <Image>(); _isLoaded = true; }
void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); col = GetComponent <BoxCollider2D>(); mainSceneManager = FindObjectOfType <MainSceneManager>(); blockAudio = GetComponents <AudioSource>(); }
void Start() { sceneManager = GameObject.FindObjectOfType <MainSceneManager>(); for (int i = 0; i < coins.Length; i++) { if (sceneManager.GetCoinState(i)) { coins[i].sprite = coinSprite; } } //次のステージが存在しないまたはアンロックされていない場合ネクストボタンを押せなくする var manager = GameManager.Instance; int nowStage = manager.NowStageIndex; var stageInfos = manager.StageInfo; if (nowStage >= stageInfos.Count) { nextButton.interactable = false; } else { var nextStageInfo = stageInfos["Stage" + (nowStage + 1).ToString()]; if (manager.GetCollectedCoinNum() < nextStageInfo.unlockCoin) { nextButton.interactable = false; } } clearComment.GetComponent <TextFade>().FadeIn(0.5f); }
public void Init(MainSceneManager sceneManager) { _sceneManager = sceneManager; PhotonNetwork.ConnectUsingSettings(); // イベント登録 //PhotonNetwork.OnEventCall += OnRaiseEvent; }
void Update() { #if UNITY_ANDROID var currentOrientation = Screen.orientation; if (previousOrientation != currentOrientation) { this.SetPlayerAgeWithOrientation(currentOrientation); timerStarted = false; this.triesRemaining--; } #endif #if UNITY_EDITOR if (Input.GetKeyDown(KeyCode.Q) && this.triesRemaining > 0) { this.stateOfPlayer = this.stateOfPlayer == PlayerState.OLD ? PlayerState.YOUNG : PlayerState.OLD; timerStarted = false; this.triesRemaining--; } #endif Debug.Log(this.stateOfPlayer); if (!varMainSceneManager) { varMainSceneManager = (MainSceneManager)GameObject.FindObjectOfType <MainSceneManager>(); } else { TimerHandler(); } }
void Start() { direction.Normalize(); rigidbody = GetComponent <Rigidbody2D>(); sceneManager = FindObjectOfType <MainSceneManager>(); bounceSound = GetComponent <AudioSource>(); }
void Start() { objectState = "Selected"; changePossible = false; objectCollider = GetComponent <BoxCollider2D>(); manager = FindObjectOfType <MainSceneManager>(); objectSprite = GetComponent <SpriteRenderer>(); audioScript = FindObjectOfType <AudioScript>(); if (objectCell) { transform.position = objectCell.transform.position; objectState = "Waiting"; } else { transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition); GetComponent <SpriteRenderer>().sortingOrder = 51; } }
// Start is called before the first frame update void Start() { _mainSceneManager = GameObject.Find("MainSceneManager").GetComponent <MainSceneManager>(); _mainGameStateManager = GameObject.Find("MainGameStateManager").GetComponent <MainGameStateManager>(); _canvasMain = GameObject.Find("CanvasMain").GetComponent <CanvasMain>(); _spriteRenderer = GetComponent <SpriteRenderer>(); _rigidbody2D = GetComponent <Rigidbody2D>(); _audioSources = GetComponents <AudioSource>(); _bodyColor = initialBodyColor; switch (_bodyColor) { case "Yellow": _spriteRenderer.color = new Color(1.0f, 1.0f, 0.5f); break; case "Cyan": _spriteRenderer.color = new Color(0.5f, 1.0f, 1.0f); break; case "Magenta": _spriteRenderer.color = new Color(1.0f, 0.5f, 1.0f); break; } }
// Start is called before the first frame update void Start() { StaminaImg = GetComponent <SpriteRenderer>(); mainSceneManager = GameObject.Find("MainSceneManager").GetComponent <MainSceneManager>(); //StaminaUpCount = 60; StaminaUpCount = mainSceneManager.staminaCountNum; }
/// <summary> /// 初期化 /// </summary> public void Init(MainSceneManager sceneManager, int posX, int posY) { _sceneManager = sceneManager; _state = State.kNone; _posX = posX; _posY = posY; }
void Start () { EventManager.AttachDelegate<PlayerEnteredAreaEvent>(this.OnPlayerEnteredAreaEvent); EventManager.AttachDelegate<ObjectPlacedInSeasonFinishedEvent>(this.OnObjectPlacedInSeason); // Hopefully this will work. this.currentSeason = MainSceneManager.SceneNameToSeasonName(this.gameObject.scene.name); Debug.Log(string.Format("LeavableItemBehavior for item {0} is in season {1}", this.gameObject.name, this.currentSeason)); }
private void Awake() { if (instance != null) { Destroy(this.gameObject); } instance = this; }
// Start is called before the first frame update void Start() { _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); _mainSceneManager = GameObject.Find("MainSceneManager").GetComponent <MainSceneManager>(); _mainGameStateManager = GameObject.Find("MainGameStateManager").GetComponent <MainGameStateManager>(); _enemyManager = GameObject.Find("EnemyManager").GetComponent <EnemyManager>(); _canvasMain = GameObject.Find("CanvasMain").GetComponent <CanvasMain>(); }
void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject.CompareTag("VictoryEnd")) { MainSceneManager mainSceneManager = MainSceneManager.getMainSceneManager(); mainSceneManager.victory(); } }
/// <summary> /// 初期化 /// </summary> /// <param name="sceneManager"></param> public void Init(MainSceneManager sceneManager) { _sceneManager = sceneManager; for (var i = 0; i < _actionCardList.Count; ++i) { _actionCardList[i].Init(this); } }
public Poi Initialize(MainSceneManager manager, string id = "") { this.manager = manager; GetComponentInChildren <Canvas>().worldCamera = manager.cam; this.id = id; StartCoroutine(InitializeInternal()); return(this); }
/// <summary> /// 魔法作成の終了 /// </summary> /// <param name="isOK">魔法編集中でも終了してよいか否か</param> public void CloseScene(bool isOK = false) { if (!isOK && isEditing) { MagicSaveCheckWindow.SaveCheck(MagicSaveCheckWindow.CheckType.close); return; } MainSceneManager.CloseScene(); }
private void Awake() { if (instance is null) { instance = this; } uiController = gameObject.GetComponent <UIController>(); }
void Awake() { // allows this instance to behave like a singleton instance = this; ApplicationState = ApplicationStateType.IdleState; textToSpeech = gameObject.AddComponent <TextToSpeech>(); textToSpeech.Voice = TextToSpeechVoice.Mark; }
void Start() { anim = GetComponent <Animator>(); anim.Play(0, gameObject.layer, Random.Range(0, 0.9f)); //Inicializa animacion en distintas posiciones de tiempo. manager = FindObjectOfType <MainSceneManager>(); audioScript = FindObjectOfType <AudioScript>(); }
//playerが移動してフェードアウト IEnumerator MovePlayer(GameObject player) { yield return(StartCoroutine(Goto_position(player))); fade.FadeOut(); yield return(new WaitForSeconds(waittime)); SceneManager.LoadScene("Boss"); MainSceneManager.EndScene(); }
void Start() { mainSceneManager = Camera.main.GetComponent <MainSceneManager>(); EventManager eventManager = WindyFramework.FrameworkEntry.GetComponent <EventManager>(); eventManager.Subscribe(EventsId.MOUSE_LEFT_BUTTON_CLICKED, OnClick); PlayerManager playerManager = WindyFramework.FrameworkEntry.GetComponent <PlayerManager>(); playerStageInfoManager = playerManager.playerStageInfoManager; }
public NodeRenderer Initialize(MainSceneManager scene, Node parent, NodeType nodeType = NodeType.Normal) { SceneManager = scene; Manager = parent; transform.position = parent.NodePos; Walls = new WallRenderer[4]; List <int> walls = new List <int>(4);//만들어질수 있는 벽 방향 if (Manager.X == 0) { walls.Add(3); //제일 왼쪽 열 : 테두리용 왼쪽 벽 추가 } if (Manager.Y == 0) { walls.Add(0); //제일 아래쪽 행 : 테투리용 아래쪽 벽 추가 } walls.Add(1); //겹치기 방지를 위해 오른쪽과 위쪽만 관리 walls.Add(2); #region 이 칸에 할당된 벽 생성 foreach (int i in walls) { if (Manager.Wall[i]) //미로상으로 있어야되는 벽 { Walls[i] = Instantiate(scene.GetWallPrefab(), transform).Initialize(this, i); } else { if (Random.value < .03f) //미로상으론 길이지만 3% 확률로 퀴즈 배치 { Quiz.Quiz quiz = Instantiate(scene.WallPoolManager.quizPrefabs[0], transform); Walls[i] = quiz.GetComponent <WallRenderer>().Initialize(this, i); quiz.Initialize(scene); } } } switch (nodeType) { case NodeType.Start: Instantiate(SceneManager.WallPoolManager.StartPrefab, transform); //시작점 장식물 추가 break; case NodeType.End: GameObject tmp = Instantiate(SceneManager.WallPoolManager.EndPrefab, transform); //도착점 장식물 추가 tmp.GetComponent <ToNextGame>().Initialize(SceneManager); break; } #endregion return(this); }
void Start() { if (!sceneManager) { sceneManager = GameObject.FindObjectOfType <MainSceneManager>(); } if (!animator) { animator = GetComponent <Animator>(); } }
public void Initialize(MainSceneManager manager) { if (manager.Particle) { particle.Play(); } else { particle.gameObject.SetActive(false); highLight.SetActive(true); } }
/// <summary> /// 초기화 /// </summary> /// <param name="manager"></param> public void Initialize(MainSceneManager manager) { this.manager = manager; #region 문제 생성 quizIndex = (int)(Random.value * manager.WallPoolManager.quizData.Count); //퀴즈 번호 뽑기 correctAnswerIndex = (int)(Random.value * buttons.Count); //랜덤한 위치에 정답 위치 wrongIndex = new int[(buttons.Count < data.WrongAnswers.Count + 1) ? buttons.Count : data.WrongAnswers.Count + 1]; //문제수와 오답수 중 더 작은걸로 지문 풀 형성 HashSet <int> set = new HashSet <int>(); for (int i = 0; i < wrongIndex.Length; i++) //겹치지 않게 랜덤하게 지정 { if (i == correctAnswerIndex) { continue; //정답이면 패쓰 } int tmp = (int)(Random.value * data.WrongAnswers.Count); while (set.Contains(tmp)) { tmp = (int)(Random.value * data.WrongAnswers.Count); } set.Add(tmp); wrongIndex[i] = tmp; } #endregion #region 하위 오브젝트에 문제 적용 for (int i = 0; i < buttons.Count; i++) { if (i < wrongIndex.Length) { buttons[i].gameObject.SetActive(true); if (i == correctAnswerIndex) { buttons[i].Initialize(this, data.GetCorrectAnswer, true); //정답일때 } else { buttons[i].Initialize(this, data.GetWrongAnswer(wrongIndex[i]), false); //오답일때 } } else { buttons[i].gameObject.SetActive(false); //지문이 다떨어졌을때 } } frontText.text = data.ProblemText; backText.text = data.ProblemText; #endregion }