111
This commit is contained in:
8
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts.meta
vendored
Normal file
8
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f71b3f45bdcc2141b89817c086dadfe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo.meta
vendored
Normal file
8
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c27e855c1de25d04dab99f3449eac973
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
145
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCam.cs
vendored
Normal file
145
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCam.cs
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// A simple free camera to be added to a Unity game object.
|
||||
///
|
||||
/// Keys:
|
||||
/// wasd / arrows - movement
|
||||
/// q/e - up/down (local space)
|
||||
/// r/f - up/down (world space)
|
||||
/// pageup/pagedown - up/down (world space)
|
||||
/// hold shift - enable fast movement mode
|
||||
/// right mouse - enable free look
|
||||
/// mouse - free look / rotation
|
||||
///
|
||||
/// </summary>
|
||||
public class FreeCam : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Normal speed of camera movement.
|
||||
/// </summary>
|
||||
public float movementSpeed = 10f;
|
||||
|
||||
/// <summary>
|
||||
/// Speed of camera movement when shift is held down,
|
||||
/// </summary>
|
||||
public float fastMovementSpeed = 100f;
|
||||
|
||||
/// <summary>
|
||||
/// Sensitivity for free look.
|
||||
/// </summary>
|
||||
public float freeLookSensitivity = 3f;
|
||||
|
||||
/// <summary>
|
||||
/// Amount to zoom the camera when using the mouse wheel.
|
||||
/// </summary>
|
||||
public float zoomSensitivity = 10f;
|
||||
|
||||
/// <summary>
|
||||
/// Amount to zoom the camera when using the mouse wheel (fast mode).
|
||||
/// </summary>
|
||||
public float fastZoomSensitivity = 50f;
|
||||
|
||||
/// <summary>
|
||||
/// Set to true when free looking (on right mouse button).
|
||||
/// </summary>
|
||||
private bool looking = false;
|
||||
|
||||
void Update()
|
||||
{
|
||||
var fastMode = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
|
||||
var movementSpeed = fastMode ? this.fastMovementSpeed : this.movementSpeed;
|
||||
|
||||
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
|
||||
{
|
||||
transform.position = transform.position + (-transform.right * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
|
||||
{
|
||||
transform.position = transform.position + (transform.right * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
|
||||
{
|
||||
transform.position = transform.position + (transform.forward * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
|
||||
{
|
||||
transform.position = transform.position + (-transform.forward * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.Q))
|
||||
{
|
||||
transform.position = transform.position + (transform.up * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.E))
|
||||
{
|
||||
transform.position = transform.position + (-transform.up * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.R) || Input.GetKey(KeyCode.PageUp))
|
||||
{
|
||||
transform.position = transform.position + (Vector3.up * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.F) || Input.GetKey(KeyCode.PageDown))
|
||||
{
|
||||
transform.position = transform.position + (-Vector3.up * movementSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (looking)
|
||||
{
|
||||
float newRotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * freeLookSensitivity;
|
||||
float newRotationY = transform.localEulerAngles.x - Input.GetAxis("Mouse Y") * freeLookSensitivity;
|
||||
transform.localEulerAngles = new Vector3(newRotationY, newRotationX, 0f);
|
||||
}
|
||||
|
||||
float axis = Input.GetAxis("Mouse ScrollWheel");
|
||||
if (axis != 0)
|
||||
{
|
||||
var zoomSensitivity = fastMode ? this.fastZoomSensitivity : this.zoomSensitivity;
|
||||
transform.position = transform.position + transform.forward * axis * zoomSensitivity;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Mouse1))
|
||||
{
|
||||
StartLooking();
|
||||
}
|
||||
else if (Input.GetKeyUp(KeyCode.Mouse1))
|
||||
{
|
||||
StopLooking();
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
StopLooking();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable free looking.
|
||||
/// </summary>
|
||||
public void StartLooking()
|
||||
{
|
||||
looking = true;
|
||||
Cursor.visible = false;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable free looking.
|
||||
/// </summary>
|
||||
public void StopLooking()
|
||||
{
|
||||
looking = false;
|
||||
Cursor.visible = true;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCam.cs.meta
vendored
Normal file
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCam.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a327e9ee6fee36c48b7b3c085b10ac47
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
74
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCamera.cs
vendored
Normal file
74
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCamera.cs
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FreeCamera : MonoBehaviour {
|
||||
public bool enableInputCapture = true;
|
||||
public bool holdRightMouseCapture = false;
|
||||
|
||||
public float lookSpeed = 5f;
|
||||
public float moveSpeed = 5f;
|
||||
public float sprintSpeed = 50f;
|
||||
|
||||
bool m_inputCaptured;
|
||||
float m_yaw;
|
||||
float m_pitch;
|
||||
|
||||
void Awake() {
|
||||
enabled = enableInputCapture;
|
||||
}
|
||||
|
||||
void OnValidate() {
|
||||
if(Application.isPlaying)
|
||||
enabled = enableInputCapture;
|
||||
}
|
||||
|
||||
void CaptureInput() {
|
||||
|
||||
m_inputCaptured = true;
|
||||
|
||||
m_yaw = transform.eulerAngles.y;
|
||||
m_pitch = transform.eulerAngles.x;
|
||||
}
|
||||
|
||||
void ReleaseInput() {
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
m_inputCaptured = false;
|
||||
}
|
||||
|
||||
void OnApplicationFocus(bool focus) {
|
||||
if(m_inputCaptured && !focus)
|
||||
ReleaseInput();
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if(!m_inputCaptured) {
|
||||
if(!holdRightMouseCapture && Input.GetMouseButtonDown(0))
|
||||
CaptureInput();
|
||||
else if(holdRightMouseCapture && Input.GetMouseButtonDown(1))
|
||||
CaptureInput();
|
||||
}
|
||||
|
||||
if(!m_inputCaptured)
|
||||
return;
|
||||
|
||||
if(m_inputCaptured) {
|
||||
if(!holdRightMouseCapture && Input.GetKeyDown(KeyCode.Escape))
|
||||
ReleaseInput();
|
||||
else if(holdRightMouseCapture && Input.GetMouseButtonUp(1))
|
||||
ReleaseInput();
|
||||
}
|
||||
|
||||
var rotStrafe = Input.GetAxis("Mouse X");
|
||||
var rotFwd = Input.GetAxis("Mouse Y");
|
||||
|
||||
m_yaw = (m_yaw + lookSpeed * rotStrafe) % 360f;
|
||||
m_pitch = (m_pitch - lookSpeed * rotFwd) % 360f;
|
||||
transform.rotation = Quaternion.AngleAxis(m_yaw, Vector3.up) * Quaternion.AngleAxis(m_pitch, Vector3.right);
|
||||
|
||||
var speed = Time.deltaTime * (Input.GetKey(KeyCode.LeftShift) ? sprintSpeed : moveSpeed);
|
||||
var forward = speed * Input.GetAxis("Vertical");
|
||||
var right = speed * Input.GetAxis("Horizontal");
|
||||
var up = speed * ((Input.GetKey(KeyCode.E) ? 1f : 0f) - (Input.GetKey(KeyCode.Q) ? 1f : 0f));
|
||||
transform.position += transform.forward * forward + transform.right * right + Vector3.up * up;
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCamera.cs.meta
vendored
Normal file
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/FreeCamera.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8380dd9a5ff44ff459b72e0cca9670de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
164
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/SuperCamera.cs
vendored
Normal file
164
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/SuperCamera.cs
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SuperCamera : MonoBehaviour {
|
||||
|
||||
public GameObject pivot;
|
||||
|
||||
public KeyCode resetShortcut = KeyCode.Space;
|
||||
|
||||
[Range(0f, 100f)]
|
||||
public float rotationSensibility = 10f;
|
||||
public bool invertRotationX = false;
|
||||
public bool invertRotationY = false;
|
||||
|
||||
[Range(0f, 100f)]
|
||||
public float translationSensibility = 10f;
|
||||
public bool invertTranslationX = false;
|
||||
public bool invertTranslationY = false;
|
||||
|
||||
public float zoomMax = 2f;
|
||||
public float zoomMin = 20f;
|
||||
|
||||
[Range(0f, 100f)]
|
||||
public float wheelSensibility = 10;
|
||||
|
||||
|
||||
private float delayDoubleClic = 0.2f;
|
||||
|
||||
|
||||
private Vector3 oldCamPos;
|
||||
private Quaternion oldCamRot;
|
||||
private Vector3 oldMousePos;
|
||||
private float timeDoubleClic;
|
||||
private bool firstClic = false;
|
||||
private Vector3 pivotPos;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
pivotPos = pivot.transform.position;
|
||||
oldCamPos = Camera.main.transform.position;
|
||||
oldCamRot = Camera.main.transform.rotation;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
Debug.DrawRay(pivotPos, Vector3.up, Color.red);
|
||||
Debug.DrawRay(pivotPos, Camera.main.transform.right, Color.green);
|
||||
|
||||
if (Input.GetKeyDown(resetShortcut))
|
||||
{
|
||||
Camera.main.transform.position = oldCamPos;
|
||||
Camera.main.transform.rotation = oldCamRot;
|
||||
}
|
||||
|
||||
float wheel = Input.GetAxis("Mouse ScrollWheel");
|
||||
if (wheel != 0f)
|
||||
{
|
||||
Vector3 movVec = (pivotPos - Camera.main.transform.position);
|
||||
movVec.Normalize();
|
||||
movVec *= wheel/ 20 * wheelSensibility;
|
||||
Vector3 newPos = Camera.main.transform.position + movVec;
|
||||
if ((newPos - pivotPos).magnitude >= zoomMax && (newPos - pivotPos).magnitude <= zoomMin)
|
||||
{
|
||||
Camera.main.transform.position = newPos;
|
||||
}
|
||||
}
|
||||
|
||||
bool doubleClic = false;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (firstClic)
|
||||
{
|
||||
doubleClic = true;
|
||||
firstClic = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstClic = true;
|
||||
timeDoubleClic = Time.time;
|
||||
}
|
||||
}
|
||||
|
||||
if (firstClic && Time.time - timeDoubleClic > delayDoubleClic)
|
||||
{
|
||||
firstClic = false;
|
||||
}
|
||||
|
||||
|
||||
if (doubleClic)
|
||||
{
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit))
|
||||
{
|
||||
pivotPos = hit.point;
|
||||
Debug.Log(hit.point);
|
||||
}
|
||||
else
|
||||
{
|
||||
pivotPos = pivot.transform.position;
|
||||
Debug.Log("reset Pivot");
|
||||
}
|
||||
}
|
||||
|
||||
if (!Input.GetMouseButton(0) && !Input.GetMouseButton(2))
|
||||
{
|
||||
//Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor.visible = false;
|
||||
}
|
||||
|
||||
Vector3 mousePos = Input.mousePosition;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(2))
|
||||
{
|
||||
oldMousePos = mousePos;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Input.GetMouseButton(2))
|
||||
{
|
||||
int factor = -1;
|
||||
if (invertTranslationX)
|
||||
{
|
||||
factor = 1;
|
||||
}
|
||||
gameObject.transform.Translate(new Vector3(factor * translationSensibility * (mousePos.x - oldMousePos.x) / 100f,0, 0));
|
||||
factor = -1;
|
||||
if (invertTranslationY)
|
||||
{
|
||||
factor = 1;
|
||||
}
|
||||
gameObject.transform.Translate(new Vector3(0, factor * translationSensibility * (mousePos.y - oldMousePos.y) / 100f, 0));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int factor = 1;
|
||||
if (invertRotationX)
|
||||
{
|
||||
factor = -1;
|
||||
}
|
||||
gameObject.transform.RotateAround(pivotPos, Vector3.up, factor * rotationSensibility * (mousePos.x - oldMousePos.x)/100f);
|
||||
factor = 1;
|
||||
if (invertRotationY)
|
||||
{
|
||||
factor = -1;
|
||||
}
|
||||
gameObject.transform.RotateAround(pivotPos, Camera.main.transform.right, factor * - rotationSensibility * (mousePos.y - oldMousePos.y)/100f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
oldMousePos = mousePos;
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/SuperCamera.cs.meta
vendored
Normal file
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/SuperCamera.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dec7eeaee8ae52f409f0518a94bad221
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
43
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/UIButton_ShowNext.cs
vendored
Normal file
43
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/UIButton_ShowNext.cs
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIButton_ShowNext : MonoBehaviour
|
||||
{
|
||||
// GameObjects list
|
||||
public GameObject[] GameObjectsList;
|
||||
private int shownGameObjectIndex = -1;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
for (int i = 0; i < GameObjectsList.Length; ++i)
|
||||
GameObjectsList[i].SetActive(false);
|
||||
SelectNextGameObject();
|
||||
}
|
||||
|
||||
|
||||
// Next or previous GameObjects onClick
|
||||
public void SelectNextGameObject()
|
||||
{
|
||||
int index = shownGameObjectIndex >= GameObjectsList.Length - 1 ? -1 : shownGameObjectIndex;
|
||||
SelectGameObject(index + 1);
|
||||
}
|
||||
public void SelectPreviousGameObject()
|
||||
{
|
||||
int index = shownGameObjectIndex <= 0 ? GameObjectsList.Length : shownGameObjectIndex;
|
||||
SelectGameObject(index - 1);
|
||||
}
|
||||
public void SelectGameObject(int index)
|
||||
{
|
||||
if (shownGameObjectIndex >= 0)
|
||||
GameObjectsList[shownGameObjectIndex].SetActive(false);
|
||||
shownGameObjectIndex = index;
|
||||
GameObjectsList[shownGameObjectIndex].SetActive(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/UIButton_ShowNext.cs.meta
vendored
Normal file
11
Assets/ThirdParty/Ciconia Studio/_Shared Files/Scripts/Demo/UIButton_ShowNext.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09c459dc70065c541a7e3b5d7ccbd6f1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user