private void SpawnKindomButton(Kindom k) { Button kindomButton = Instantiate(kindomButtonPrefab, kindomButtonsContainer).GetComponent <Button>(); kindomButton.onClick.AddListener(() => LookAtKindom(k)); kindomButton.transform.GetChild(0).GetComponentInChildren <Text>().text = k.name; }
private void SpawnKindomPoint(Kindom k) { GameObject kindom = Instantiate(kindomPointPrefab, modelTransform); kindom.transform.localEulerAngles = new Vector3(k.y + visualOffset.y, -k.x - visualOffset.x, 0); k.visulaPoint = kindom.transform.GetChild(0); SpawnKindomButton(k); }
public void LookAtKindom(Kindom k) { Transform cameraParent = Camera.main.transform.parent; Transform cameraPivot = cameraParent.parent; cameraParent.DOLocalRotate(new Vector3(k.y, 0, 0), lookDuration, RotateMode.Fast).SetEase(lookEase); cameraPivot.DOLocalRotate(new Vector3(0, -k.x, 0), lookDuration, RotateMode.Fast).SetEase(lookEase); FindObjectOfType <FollowTarget>().target = k.visulaPoint; }