void Start() { controllerScript = controller.GetComponent <RotateController> (); recRed = red.GetComponent <RectTransform> (); recYellow = yellow.GetComponent <RectTransform> (); recGreen = green.GetComponent <RectTransform> (); recBlue = blue.GetComponent <RectTransform> (); recPurple = purple.GetComponent <RectTransform> (); recWhite = white.GetComponent <RectTransform> (); rightRedBorder = recRed.transform.position; rightYellowBorder = recYellow.transform.position; rightGreenBorder = recGreen.transform.position; rightBlueBorder = recBlue.transform.position; rightPurpleBorder = recPurple.transform.position; rightWhiteBorder = recWhite.transform.position; leftRedBorder = rightRedBorder - new Vector3(20.0f, 0.0f, 0.0f); leftYellowBorder = rightYellowBorder - new Vector3(20.0f, 0.0f, 0.0f); leftGreenBorder = rightGreenBorder - new Vector3(20.0f, 0.0f, 0.0f); leftBlueBorder = rightBlueBorder - new Vector3(20.0f, 0.0f, 0.0f); leftPurpleBorder = rightPurpleBorder - new Vector3(20.0f, 0.0f, 0.0f); leftWhiteBorder = rightWhiteBorder - new Vector3(20.0f, 0.0f, 0.0f); }
public virtual void InitElement(UnityEngine.Object obj, Action <bool> showMenuAction, Transform parentScale, ControllesMenu.Controllers control) { ShowMenuAction = showMenuAction; this.parentScale = parentScale; scale = control.Scale; rotate = control.Rotate; move = control.Move; }
public static RotateController getInstance() { if (_instance == null) { _instance = new RotateController(); } return(_instance); }
private void OnTriggerEnter(Collider other) { if (other.name == "Player" && entered == false) { entered = true; Vector3 distance = new Vector3(0, 3, 0); var group = RotateController.getInstance().getRotatingGroup(1); foreach (Rotating r in group) { Vector3 target = r.transform.localPosition + distance; StartCoroutine(MoveToPosition(r, target)); } } }
void Update() { if (Input.GetKeyDown(KeyCode.E)) { if (!(Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.W))) { RotateController.getInstance().selectNext(); } } if (Input.GetKeyDown(KeyCode.R)) { if (!(Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.W))) { RotateController.getInstance().selectPre(); } } }
void Victory() { GetComponent <PlayerController>().enabled = false; RotateController rc = transform.parent.GetComponent <RotateController>(); rc.playing = false; rc.playerPos = new Vector2(5, 10); rc.addPos = new Vector3(rc.addPos.x, rc.addPos.y, rc.addPos.z + 10); finishing = true; StartCoroutine(wait()); /*explosions = finalWall.transform.GetChild(2); * Component[] particles = explosions.gameObject.GetComponentsInChildren<ParticleSystem>(); * print(particles.Length); * foreach (Transform child in explosions) * { * print("playing"); * child.GetComponent<ParticleSystem>().Play(); * }*/ }
// Use this for initialization void Start() { if (walker == null) { walker = GetComponent <SplineWalker>(); } rotateController = GetComponent <RotateController>(); //init delegates if (onOne != null) { walker.onOne += onOne.Invoke; } if (onZero != null) { walker.onZero += onZero.Invoke; } if (onMid != null) { walker.onMid += onMid.Invoke; } }
private void MakeMap(IMapData mapData) { RotateController.getInstance().clearRotatings(); GameObject[] floor = GameObject.FindGameObjectsWithTag("Floor"); foreach (GameObject obj in floor) { GameObject.Destroy(obj); } GameObject[] end = GameObject.FindGameObjectsWithTag("Endpoint"); foreach (GameObject obj in end) { GameObject.Destroy(obj); } foreach (Vector3 pos in mapData.CubePos) { GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.tag = "Floor"; cube.name = "C" + pos.x + pos.y + pos.z; // 'C'ube cube.transform.position = pos; } for (int i = 0; i < mapData.SlopePos.Length; i++) { GameObject slope = makeSlope(); Vector3 pos = mapData.SlopePos[i]; slope.tag = "Floor"; slope.name = "S" + pos.x + pos.y + pos.z; // 'S'lope slope.transform.position = pos; slope.transform.rotation = mapData.SlopeRot[i]; } foreach (RotatingObject data in mapData.RotObj) { GameObject obj = GameObject.Find(data.name); if (obj == null) { continue; } Rotating script = obj.AddComponent <Rotating>() as Rotating; script.point = data.point; script.axis = data.axis; script.PlayerRot = data.playerRot; RotateController.getInstance().addRotating(script, data.groupId); } { GameObject player = GameObject.Find("Player"); player.transform.position = new Vector3(mapData.PlayerStart.x, mapData.PlayerStart.y + 1, mapData.PlayerStart.z); // player.GetComponent <MoveCharacter>().Init(); } //关卡终点 { GameObject endpoint = (GameObject)Resources.Load("Prefabs/endpoint"); endpoint.tag = "Endpoint"; endpoint.transform.position = mapData.GameEnd; Object.Instantiate(endpoint); } //升降 { //************************ //ImapData的底层数据结构设计比较糟糕,修改会影响到其他地图,因此可升降平台在此写死 //************************ if (id == 3) { Map03 mapData03 = (Map03)mapData; GameObject movePoint = (GameObject)Resources.Load("Prefabs/movepoint"); movePoint.transform.position = mapData03.MovePoint; Object.Instantiate(movePoint); } } RotateController.getInstance().select(); }
private void Start() { _circleRotateController = GameObject.FindWithTag("Circle").GetComponent <RotateController>(); SpawnCoin(); }
public RotateView(RotateController rotateController) { this.InitializeComponent(); this.rotateController = rotateController; }