diff --git a/GGJ17/Assets/Material/SpawnParticleTrailMaterial.mat b/GGJ17/Assets/Material/SpawnParticleTrailMaterial.mat index 7481375..1559d83 100644 Binary files a/GGJ17/Assets/Material/SpawnParticleTrailMaterial.mat and b/GGJ17/Assets/Material/SpawnParticleTrailMaterial.mat differ diff --git a/GGJ17/Assets/Material/SpawnSplashParticleTrailMaterial.mat b/GGJ17/Assets/Material/SpawnSplashParticleTrailMaterial.mat index 7481375..2372b5a 100644 Binary files a/GGJ17/Assets/Material/SpawnSplashParticleTrailMaterial.mat and b/GGJ17/Assets/Material/SpawnSplashParticleTrailMaterial.mat differ diff --git a/GGJ17/Assets/Prefab/BuildingBlocks/Building_Extractor.prefab b/GGJ17/Assets/Prefab/BuildingBlocks/Building_Extractor.prefab index ebef92b..62a53f1 100644 Binary files a/GGJ17/Assets/Prefab/BuildingBlocks/Building_Extractor.prefab and b/GGJ17/Assets/Prefab/BuildingBlocks/Building_Extractor.prefab differ diff --git a/GGJ17/Assets/Scene/MainScene.unity b/GGJ17/Assets/Scene/MainScene.unity index 4836d5f..a630074 100644 Binary files a/GGJ17/Assets/Scene/MainScene.unity and b/GGJ17/Assets/Scene/MainScene.unity differ diff --git a/GGJ17/Assets/Script/IsoCamera.cs b/GGJ17/Assets/Script/IsoCamera.cs index d02403e..442211c 100644 --- a/GGJ17/Assets/Script/IsoCamera.cs +++ b/GGJ17/Assets/Script/IsoCamera.cs @@ -2,24 +2,28 @@ using System.Collections.Generic; using UnityEngine; -public class IsoCamera : MonoBehaviour { - +public class IsoCamera : MonoBehaviour +{ + public float panSpeed = 10, rotateSpeed = 100, zoomSpeed = 5; private const float camFocusHeight = 0; private Vector3 focusPoint, mousePosition; private new Camera camera; + public float zoomMin, zoomMax; - // Use this for initialization - void Awake () { + // Use this for initialization + void Awake() + { camera = GetComponent(); Vector3 globalCamForwardDir = transform.forward; Vector3 downProjectedCamForward = Vector3.Project(transform.TransformVector(Vector3.forward), Vector3.down); float m = (transform.position.y - camFocusHeight) / downProjectedCamForward.magnitude; focusPoint = transform.position + globalCamForwardDir * m; } - - // Update is called once per frame - void Update () { + + // Update is called once per frame + void Update() + { #region pan Vector3 localMove = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0); Vector3 groundMove = Vector3.ProjectOnPlane(transform.TransformVector(localMove), Vector3.up); @@ -29,8 +33,8 @@ void Update () { focusPoint += translation; #endregion // poll the mouse - if (Input.GetMouseButton(1)) #region rotate + if (Input.GetMouseButton(1)) { Vector2 rotation = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); rotation *= rotateSpeed * Time.deltaTime; @@ -42,7 +46,22 @@ void Update () { } #endregion #region zoom - camera.orthographicSize += Input.mouseScrollDelta.y * zoomSpeed * Time.deltaTime; + // reset if out of bounds + if (camera.orthographicSize < zoomMin) + { + camera.orthographicSize = zoomMin; + } + else if (camera.orthographicSize > zoomMax) + { + camera.orthographicSize = zoomMax; + } + // only move if target position is within bounds + float targetZoom = camera.orthographicSize + Input.mouseScrollDelta.y * zoomSpeed * Time.deltaTime; + if ((targetZoom >= zoomMin) && + (targetZoom <= zoomMax)) + { + camera.orthographicSize = targetZoom; + } #endregion } diff --git a/GGJ17/Assets/Script/WorldControl.meta b/GGJ17/Assets/Script/WorldControl.meta deleted file mode 100644 index a651a32..0000000 --- a/GGJ17/Assets/Script/WorldControl.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 026ecd435f5e8484da51e65011b7b01b -folderAsset: yes -timeCreated: 1485043945 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: