private void Start() { if (!MiniMap) { MiniMap = FindObjectOfType <MiniMapController>(); } }
public void OnEnable() { mController = GameObject.Find("Canvas/MiniMap").GetComponent <MiniMapController>(); if (!mController.getIsMiniMap) { pos = transform.position; StartCoroutine(Shake()); } }
void Start() { mMapController = GameObject.Find("Canvas/MiniMap").GetComponent <MiniMapController>(); sController = GameObject.Find("Controller").GetComponent <StageController>(); mMapController.NowMap(); pot_ctr = FindObjectOfType <PotController>(); AttributePot(transform.root.GetComponent <MapInfo>().attribute); }
// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player collect the pickup if (other.gameObject.tag == Tags.playerTag) { // Collect the key - remove minimap icon keyCollected = true; MiniMapController.RemoveMapObject(gameObject); } }
// Update is called once per frame void LateUpdate() { if (!isPaused && Player.HasOrbem()) { if (Player.CanSwitchWorld() && UIPowerBar.IsEmpty() && !WorldManager.IsWorldFuture() && MaskController.CanBeOpenedOrClosed()) { StartCoroutine(TeleportToFuture()); } if (Input.GetButtonDown("Open/Close Gate") && CanSwitchWorld()) { SwitchWorld(); } if (WorldManager.IsWorldFuture() && Input.GetButtonDown("MiniMap") && !UIPowerBar.IsEmpty()) { MiniMapController.SwitchMiniMapState(); } if (Input.GetKeyDown("v")) { Debug.Log("Start decrease"); UIPowerBar.StartDecrease(2f); } if (Input.GetKeyDown("b")) { Debug.Log("Start regen"); UIPowerBar.StartRegen(); } } if (Input.GetButtonDown("Pause")) { if (isPaused) { Resume(); UIManager.HidePauseMenu(); } else { Pause(); UIManager.DisplayPauseMenu(); } } // delay next update by 1 frame to prevent from "jumping" with a controller if (isPaused && pauseExited) { isPaused = false; pauseExited = false; } }
// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player collect the pickup if (other.gameObject.tag == Tags.playerTag) { // Collect the pickup - add points - remove minimap icon pickupCollected = true; other.gameObject.GetComponent <PlayerController>().AddToScore(points); MiniMapController.RemoveMapObject(gameObject); } }
// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player collect the pickup if (other.gameObject.tag == Tags.playerTag) { // Collect the pickup - add points - remove minimap icon healthCollected = true; other.gameObject.GetComponent <PlayerController>().AddToHealth(health); MiniMapController.RemoveMapObject(gameObject); GameDataManager.instance.HealthCollected(Index()); } }
private void SetupProperties() { Instance = this; if (!MessageMenu) { MessageMenu = FindObjectOfType <MessageMenu>(); } if (!Controller) { Controller = FindObjectOfType <MenuController>(); } if (!Music) { Music = FindObjectOfType <MusicController>(); } if (!World) { World = FindObjectOfType <WorldController>(); } if (!MiniMap) { MiniMap = FindObjectOfType <MiniMapController>(); } if (!Player) { Player = FindObjectOfType <PlayerController>(); } if (!Score) { Score = FindObjectOfType <ScoreManager>(); } if (Score) { Score.Game = this; } if (Music) { Music.Reset(); } GameModeManager.Instance.Game = this; }
// Use this for initialization void Start() { direc = Direction.LEFT; pManager = GameObject.Find("PlayerStatus").GetComponent <PlayerManager>(); PotObject = FindObjectOfType <PotController>().gameObject; rig = gameObject.transform.parent.GetComponent <Rigidbody2D>(); player_ctr = GameObject.Find("Controller").GetComponent <PlayerController>(); bringctr = gameObject.transform.parent.GetChild(0).GetComponent <BringCollider>(); alchemyUI_ctr = GameObject.Find("Canvas/Alchemy_UI").GetComponent <AlchemyUIController>(); miniMap_ctr = GameObject.Find("Canvas/MiniMap").GetComponent <MiniMapController>(); anim_ctr = gameObject.transform.parent.GetComponent <AnimController>(); leg_col = gameObject.transform.parent.GetComponentInChildren <LegCollider>(); crossAxisDown = gameObject.GetComponent <CrossAxisDown>(); }
// Use this for initialization void Awake() { if (instance == null) { instance = this; // by default always disable the minimap instance.gameObject.SetActive(false); } else { Destroy(gameObject); } }
void OnEnable() { miniMapController = GameObject.Find("CanvasMiniMap").GetComponent <MiniMapController> (); mme = new MiniMapEntity(); mme.icon = icon; mme.rotation = initialIconRotation; mme.size = size; mme.upAxis = upAxis; mme.rotateWithObject = rotateWithObject; mme.clampInBorder = clampIconInBorder; mme.clampDist = clampDistance; mmo = miniMapController.RegisterMapObject(this.gameObject, mme); }
public void SetMiniMapEntityValues(MiniMapController controller, MiniMapEntity mme, GameObject attachedGO, Camera renderCamera, GameObject parentPanelGO) { linkedMiniMapEntity = mme; owner = attachedGO; mapCamera = renderCamera; panelGO = parentPanelGO; spr = gameObject.GetComponent <Image> (); spr.sprite = mme.icon; sprRect = spr.gameObject.GetComponent <RectTransform> (); sprRect.sizeDelta = mme.size; rt = panelGO.GetComponent <RectTransform> (); mmc = controller; miniMapTarget = mmc.target; SetPositionAndRotation(); }
void Awake() { instance = this; controller = new MiniMapController(); poolManager = GetComponent <MiniMapPoolManager>(); miniMapSize = transform.GetComponent <RectTransform>().sizeDelta; elementIconDict = new Dictionary <int, Transform>(); elementIconParent = transform.FindChild("Mask/ElementParent").transform; controller.OnCreate(); }
// References //public GameDataManager GameDataManager.instance; ///////////////////////End of Variables///////////////////////// ///////////////////////////Functions//////////////////////////// // Use this for initialization void Start() { // Assign the reference to the game data manager //GameDataManager.instance = GameDataManager.instance; // Set the character icons and characters -- male selected if (GameDataManager.instance.SelectedGender() == GENDER.MALE) { MiniMapController.RegisterMapObject(gameObject, miniMapImageMale); } // Set the character icons and characters -- female selected else if (GameDataManager.instance.SelectedGender() == GENDER.FEMALE) { MiniMapController.RegisterMapObject(gameObject, miniMapImageFemale); } }
public void TeleportToPresent() { MiniMapController.HideMiniMap(); Player.SwitchWorld(); // UI UIPowerBar.SetListener(new PowerBarListenerForSwitch()); UIPowerBar.StartDecrease(2f); // start opening the gate asynchronously Debug.Log("OpenGate Async"); instance.StartCoroutine(MaskController.instance.OpenGateAsync()); // display the second camera WorldManager.SwitchWorld(); Player.instance.wallHit = false; }
void Awake() { if (GameObject.Find("Controller")) { sController = GameObject.Find("Controller").GetComponent <StageController>(); pController = GameObject.Find("Controller").GetComponent <PlayerController>(); } if (GameObject.Find("PlayerStatus")) { pManager = GameObject.Find("PlayerStatus").GetComponent <PlayerManager>(); } if (GameObject.Find("MiniMap")) { mMapController = GameObject.Find("MiniMap").GetComponent <MiniMapController>(); } }
void Start() { SetList(); wall = GameObject.Find("Walls"); clearPanel = FindObjectOfType <GameClear>().gameObject; clearPanel.SetActive(false); SetWater(); pController = FindObjectOfType <PlayerController>(); mMapController = FindObjectOfType <MiniMapController>(); cManager = FindObjectOfType <CameraManager>(); if (waters != null) { foreach (var i in Waters) { i.SetActive(false); } } SoundManager.Instance.PlayBgm((int)SoundManager.BGMNAME.BGM_MAINFAST); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { GameObject go = Instantiate(soldierGo) as GameObject; go.transform.parent = goParent; go.transform.localPosition = new Vector3(Random.Range(-15, 15), 0, Random.Range(-15, 15)); lastGo = go; } if (Input.GetKeyDown(KeyCode.Alpha2)) { GameObject go = Instantiate(towerGo) as GameObject; go.transform.parent = goParent; go.transform.localPosition = new Vector3(Random.Range(-15, 15), 0, Random.Range(-15, 15)); lastGo = go; } if (Input.GetKeyDown(KeyCode.Z)) { effectId = MiniMapController.MakeId(); MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Create, effectId, MiniMapElementIconType.Effect1); MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Update, effectId, lastGo.transform.position); b = true; } if (Input.GetKeyDown(KeyCode.X)) { MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Destroy, effectId); effectId = 0; } if (Input.GetKeyDown(KeyCode.C)) { MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Update, effectId, MiniMapElementIconType.Effect2); } if (Input.GetKeyDown(KeyCode.U)) { lastGo.GetComponent <MiniMapElement>().enabled = !lastGo.GetComponent <MiniMapElement>().enabled; } }
void Update() { icon.SetActive(lineRenderer.enabled); if (flag != null && flag.transform.childCount <= 0) { lineRenderer.enabled = false; } if (MiniMapController.GetInstance().canMove) { targetPosition = MiniMapController.GetInstance().clickPosition; DrawNavigationLine(targetPosition, isSetDestination, true); MiniMapController.GetInstance().canMove = false; } //自动寻路 if (CheckMoseButtonDown(1) && !MiniMapController.GetInstance().isEnterMiniMap) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { isSetDestination = true; targetPosition = hit.point; ShowClickEffect(hit.point); DrawNavigationLine(hit.point, true, false); } } if (isArrive) { isSetDestination = false; lineRenderer.enabled = false; if (flag != null && flag.transform.childCount > 0) { Destroy(flag.transform.GetChild(0).gameObject); } } if (flag.transform.childCount == 0) { agent.ResetPath(); } isArrive = Vector3.Distance(player.transform.position, targetPosition) < 2; }
void Start() { if (!Music) { Music = FindObjectOfType <MusicController>(); } if (!World) { World = FindObjectOfType <WorldController>(); } if (!MiniMap) { MiniMap = FindObjectOfType <MiniMapController>(); } if (!Player) { Player = FindObjectOfType <PlayerController>(); } States = new List <GameState>(); var states = FindObjectsOfType <GameState>(); foreach (var state in states) { state.Init(this); States.Add(state); } CurrentState = States.FirstOrDefault(s => s is StartState); if (CurrentState) { CurrentState.CallStart(); } }
// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player if (other.gameObject.tag == Tags.playerTag) { // If the key has been collected if (keyCollected) { // Open the chest chestOpened = true; anim.SetBool("Key", true); // Aadd points other.gameObject.GetComponent<PlayerController>().AddToScore(points); // Remove minimap icon MiniMapController.RemoveMapObject(gameObject); } // Key not collected else if (!keyCollected && !chestOpened) anim.SetTrigger("NoKey"); } }
// References //public GameDataManager GameDataManager.instance; ///////////////////////End of Variables///////////////////////// ///////////////////////////Functions//////////////////////////// // Use this for initialization void Start() { // Assign the reference to the game data manager //GameDataManager.instance = GameDataManager.instance; // Set the character icons and characters -- male selected if (GameDataManager.instance.CivillianType() == CIVILLIANTYPE.MALE) { MiniMapController.RegisterMapObject(gameObject, miniMapImageMale); } // Set the character icons and characters -- female selected else if (GameDataManager.instance.CivillianType() == CIVILLIANTYPE.FEMALE) { MiniMapController.RegisterMapObject(gameObject, miniMapImageFemale); } // Set the character icons and characters -- female selected else if (GameDataManager.instance.CivillianType() == CIVILLIANTYPE.CAT) { MiniMapController.RegisterMapObject(gameObject, miniMapImageCat); } }
void Awake() { main = this; mat = GLMatShader.GetGLMaterial (); }
void Start() { MiniMapController.RegisterMapObject(this.gameObject, image); }
void OnDestroy() { MiniMapController.RemoveMapObject(this.gameObject); }
// x:[-0.5f, 0.5f] void Awake() { Instance = this; }
// Update is called once per frame void OnDestroy() { //if the object is destroyed, Remove the object from the list //ex: items the generated by the spawners MiniMapController.RemoveMapObject(gameObject); }
void LateUpdate() { isAutoMove = controller.agent.hasPath && controller.agent.remainingDistance > controller.agent.radius; if (CameraUpAndDown) { if (Input.GetMouseButton(2)) { if (!mbMouseButtonDown) { mMouseDownPos = Input.mousePosition; mbMouseButtonDown = true; } else { Vector3 curpos = Input.mousePosition; float deltaY = mMouseDownPos.y - curpos.y; yDistance += deltaY * 0.008f; yDistance = Mathf.Clamp(yDistance, MinCameraPos, MaxCameraPos); mMouseDownPos = curpos; } } else { mbMouseButtonDown = false; } } if (isAutoMove) { if (!CameraUpAndDown) { yDistance = 3; } Distance = 6; mY = Target.localEulerAngles.x; mX = Target.localEulerAngles.y; } else if (!MiniMapController.GetInstance().isEnterMiniMap) { //鼠标右键旋转 if (Input.GetMouseButton(1)) { //获取鼠标输入 mX += Input.GetAxis("Mouse X") * SpeedX * 0.02F; mY -= Input.GetAxis("Mouse Y") * SpeedY * 0.02F; //范围限制 mY = ClampAngle(mY, MinLimitY, MaxLimitY); } //鼠标滚轮缩放 Distance -= Input.GetAxis("Mouse ScrollWheel") * ZoomSpeed; Distance = Mathf.Clamp(Distance, MinDistance, MaxDistance); } //重新计算位置和角度 mRotation = Quaternion.Euler(mY, mX, 0); mPosition = mRotation * new Vector3(0.0F, yDistance, -Distance) + Target.position; if (isNeedDamping) { //球形插值 transform.rotation = Quaternion.Lerp(transform.rotation, mRotation, Time.deltaTime * Damping); //线性插值 transform.position = Vector3.Lerp(transform.position, mPosition, Time.deltaTime * Damping); } else { transform.rotation = mRotation; transform.position = mPosition; } //将玩家转到和相机对应的位置上 if (!isAutoMove && (controller.State == PlayerController.PlayerState.Walk || controller.State == PlayerController.PlayerState.Run)) { Target.rotation = Quaternion.Slerp(Target.rotation, Quaternion.Euler(0, mX, 0), Time.deltaTime); } }
RectTransform rectTransform; //Transform data of the minimap, it scales with the resolution void Awake() { Main = this; }
void Awake() { main = this; mat = GLMatShader.GetGLMaterial(); }
/// <summary> /// マップの生成 9つ分 /// </summary> /// <param name="datas"></param> public void CreateMap(MapData[] datas) { // 配列の長さを取得 再編集 int xLength = datas[0].mapDate.Length; int yLength = datas[0].mapDate.Length; // タイルのサイズを取得 float tileSize = 2; float stageSize = tileSize * xLength; for (int i = 0; i < datas.Length; i++) { int quo = i / 3; int rem = i % 3; // Y軸方向に3ステージ分あげる Vector2 startPos = new Vector2(0, stageSize * 3); // ルートオブジェクトの作成 string rootName = datas[i].name; var rootObj = new GameObject(rootName); rootObj.AddComponent <MapInfo>(); rootObj.GetComponent <MapInfo>().MapNumX = rem; rootObj.GetComponent <MapInfo>().MapNumY = quo; rootObj.transform.position = startPos + new Vector2(stageSize / 2, -stageSize / 2) + new Vector2(rem * stageSize, -quo * stageSize); // ジャンル別の空のオブジェクト生成 var tileObjectGroupe = new GameObject("TileObject"); var gimmickObjectGroupe = new GameObject("GimmickObject"); var OtherObjectGroupe = new GameObject("OtherObject"); tileObjectGroupe.transform.position = rootObj.transform.position; gimmickObjectGroupe.transform.position = rootObj.transform.position; OtherObjectGroupe.transform.position = rootObj.transform.position; // 親子付け tileObjectGroupe.transform.parent = rootObj.transform; gimmickObjectGroupe.transform.parent = rootObj.transform; OtherObjectGroupe.transform.parent = rootObj.transform; // 背景オブジェクトの生成 GameObject backGroundObject = new GameObject("BG"); backGroundObject.layer = 2; backGroundObject.AddComponent <SpriteRenderer>(); backGroundObject.GetComponent <SpriteRenderer>().sortingOrder = -1; backGroundObject.AddComponent <BoxCollider2D>(); backGroundObject.GetComponent <BoxCollider2D>().size = new Vector2(xLength * 0.5f + 0.25f, xLength * 0.5f + 0.25f); backGroundObject.transform.parent = rootObj.transform; backGroundObject.transform.localPosition = Vector3.zero + new Vector3(-tileSize * 0.5f, tileSize * 0.5f, 0); backGroundObject.GetComponent <SpriteRenderer>().sprite = backImages[datas[i].backGroundNum - 1]; MiniMapController miniMapController = GameObject.Find("Canvas/MiniMap").GetComponent <MiniMapController>(); miniMapController.MSprite[i] = backGroundObject.GetComponent <SpriteRenderer>().sprite; switch (datas[i].backGroundNum) { case 0: // NONE break; case 1: // Normal backGroundObject.transform.root.GetComponent <MapInfo>().attribute = MapInfo.Attribute.NORMAL; break; case 2: // Ice backGroundObject.transform.root.GetComponent <MapInfo>().attribute = MapInfo.Attribute.ICE; break; case 3: // Thunder backGroundObject.transform.root.GetComponent <MapInfo>().attribute = MapInfo.Attribute.THUNDER; break; case 4: // Rock(under) case 5: // Rock(under) backGroundObject.transform.root.GetComponent <MapInfo>().attribute = MapInfo.Attribute.ROCK; break; default: break; } backGroundObject.transform.localScale = new Vector3(stageSize / backGroundObject.GetComponent <SpriteRenderer>().size.x, stageSize / backGroundObject.GetComponent <SpriteRenderer>().size.y, 0); if (backGroundObject.GetComponent <SpriteRenderer>().sprite.name != "Empty" && backGroundObject.GetComponent <SpriteRenderer>().sprite.name != "Empty2") { backGroundObject.GetComponent <BoxCollider2D>().isTrigger = true; backGroundObject.AddComponent <MapChange>(); } else { backGroundObject.layer = LayerMask.NameToLayer("Background"); } // オブジェクトの生成 for (int y = 0; y < yLength; y++) { for (int x = 0; x < xLength; x++) { int tilenum = datas[i].mapDate[y].mapNum[x]; int gimmickNum = datas[i].gimmickDate[y].mapNum[x]; int enemyNum = datas[i].enemyDate[y].mapNum[x]; // 通常タイル if (tilenum != 0) { // 生成 var tileObj = Instantiate(GetTile(tilenum).TileObj); tileObj.name = tileObj.name + x + "-" + y; tileObj.transform.position = startPos + new Vector2(tileSize * x, -tileSize * y) + new Vector2(tileSize * xLength * rem, -tileSize * yLength * quo); tileObj.transform.parent = tileObjectGroupe.transform; //周りにはしごギミックがあったらレイヤーを変更 if (gimmickNum != 0) { if (GetGimmick(gimmickNum).GimmickObj.GetComponent <GimmickInfo>() != null && GetGimmick(gimmickNum).GimmickObj.GetComponent <GimmickInfo>().type == GimmickInfo.GimmickType.LADDER) { // レイヤー変更 Debug.Log("aaa"); tileObj.layer = LayerMask.NameToLayer("LadderBlock"); } ////// 1つ先のブロックも検索する //if (x <= xLength && datas[i].gimmickDate[y].mapNum[x + 1] != 0 && GetGimmick(datas[i].gimmickDate[y].mapNum[x + 1]).GimmickObj.GetComponent<GimmickInfo>() != null) if (GetGimmick(gimmickNum).GimmickObj.transform.childCount != 0 && GetGimmick(gimmickNum).GimmickObj.transform.GetChild(0).GetComponent <GimmickInfo>() != null && GetGimmick(gimmickNum).GimmickObj.transform.GetChild(0).GetComponent <GimmickInfo>().type == GimmickInfo.GimmickType.LADDER) { tileObj.layer = LayerMask.NameToLayer("LadderBlock"); } } } // ギミック if (gimmickNum != 0) { // 生成 var gimmickObj = Instantiate(GetGimmick(gimmickNum).GimmickObj); gimmickObj.name = gimmickObj.name + x + "-" + y; gimmickObj.transform.position = startPos + new Vector2(tileSize * x, -tileSize * y) + new Vector2(tileSize * xLength * rem, -tileSize * yLength * quo); gimmickObj.transform.parent = gimmickObjectGroupe.transform; } // エネミーやポジション if (enemyNum != 0) { var enemyObj = Instantiate(GetEnemy(enemyNum).EnemyObj); // スタート位置の配置 if (enemyObj.tag == "StartPos") { SetParentPlayer(OtherObjectGroupe, startPos + new Vector2(tileSize * x, -tileSize * y) + new Vector2(tileSize * xLength * rem, -tileSize * yLength * quo)); } enemyObj.transform.position = startPos + new Vector2(tileSize * x, -tileSize * y) + new Vector2(tileSize * xLength * rem, -tileSize * yLength * quo); enemyObj.transform.parent = OtherObjectGroupe.transform; } } } mapObjects[i] = rootObj; } StageController stageController = FindObjectOfType <StageController>(); stageController.SetMapList = mapObjects; }