added camera switch and camera movement inside the hall, will have to add the zooming animation or the transition
This commit is contained in:
parent
7ea15eedf9
commit
56a926ec34
|
|
@ -93,6 +93,7 @@
|
|||
<Compile Include="Assets\TextMesh Pro\Examples & Extras\Scripts\TMP_FrameRateCounter.cs" />
|
||||
<Compile Include="Assets\TextMesh Pro\Examples & Extras\Scripts\VertexJitter.cs" />
|
||||
<Compile Include="Assets\TextMesh Pro\Examples & Extras\Scripts\TMP_TextEventHandler.cs" />
|
||||
<Compile Include="Assets\Game\Scenes\TestScene\TestSceneScripts\MineScript.cs" />
|
||||
<Compile Include="Assets\Game\Scripts\GetPrice.cs" />
|
||||
<Compile Include="Assets\TextMesh Pro\Examples & Extras\Scripts\TMP_TextSelector_B.cs" />
|
||||
<Compile Include="Assets\Game\Scripts\GemsManager.cs" />
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,61 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraControl : MonoBehaviour
|
||||
{
|
||||
public Camera[] cameras;
|
||||
private int currentCameraIndex;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
currentCameraIndex = 0;
|
||||
|
||||
|
||||
for (int i=1; i<cameras.Length; i++)
|
||||
{
|
||||
cameras[i].gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (cameras.Length>0)
|
||||
{
|
||||
cameras [0].gameObject.SetActive (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Update ()
|
||||
{
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C))
|
||||
{
|
||||
Transition();
|
||||
}
|
||||
}
|
||||
|
||||
public void Transition()
|
||||
{
|
||||
//Play transition
|
||||
ChangeCam();
|
||||
}
|
||||
|
||||
|
||||
public void ChangeCam()
|
||||
{
|
||||
currentCameraIndex ++;
|
||||
|
||||
if (currentCameraIndex < cameras.Length)
|
||||
{
|
||||
cameras[currentCameraIndex-1].gameObject.SetActive(false);
|
||||
cameras[currentCameraIndex].gameObject.SetActive(true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cameras[currentCameraIndex-1].gameObject.SetActive(false);
|
||||
currentCameraIndex = 0;
|
||||
cameras[currentCameraIndex].gameObject.SetActive(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a10b68a6e1360c1428677384d2539cf0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/Game/Scenes/TestScene/TestSceneScripts/MoveCamera.cs
Normal file
60
Assets/Game/Scenes/TestScene/TestSceneScripts/MoveCamera.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class MoveCamera : MonoBehaviour
|
||||
{
|
||||
public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 }
|
||||
public RotationAxes axes = RotationAxes.MouseXAndY;
|
||||
public float sensitivityX = 2F;
|
||||
public float sensitivityY = 2F;
|
||||
public float minimumY = -90F;
|
||||
public float maximumY = 90F;
|
||||
float rotationY = -60F;
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
MouseInput();
|
||||
}
|
||||
|
||||
void MouseInput()
|
||||
{
|
||||
if (EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
MouseRightClick();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MouseRightClick()
|
||||
{
|
||||
if (axes == RotationAxes.MouseXAndY)
|
||||
{
|
||||
float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;
|
||||
|
||||
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
|
||||
rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);
|
||||
|
||||
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
|
||||
}
|
||||
else if (axes == RotationAxes.MouseX)
|
||||
{
|
||||
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
|
||||
rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);
|
||||
|
||||
transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 109504a96ffb810449df1c179378f55e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class CameraController : MonoBehaviour
|
||||
public class CameraManager : MonoBehaviour
|
||||
{
|
||||
public Transform cam;
|
||||
public float sensitivity;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user