Added basic guard camera, spy camera, and right-click-to-move

This commit is contained in:
darrelmarek 2017-09-18 11:10:49 -05:00
parent cf7826fd88
commit 62d26f586c
12 changed files with 359 additions and 23 deletions

View file

@ -0,0 +1,114 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1889434021946074}
m_IsPrefabParent: 1
--- !u!1 &1889434021946074
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4661043116803332}
- component: {fileID: 114306799516802978}
- component: {fileID: 20437103875467350}
- component: {fileID: 124909405360866564}
- component: {fileID: 92524413853108834}
- component: {fileID: 81070402336043930}
m_Layer: 0
m_Name: Guard Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4661043116803332
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1889434021946074}
m_LocalRotation: {x: 0.35355338, y: -0.35355338, z: 0.1464466, w: 0.8535535}
m_LocalPosition: {x: 4.5, y: 3, z: -4.5}
m_LocalScale: {x: 0.5, y: 1, z: 0.5}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 45, y: -45, z: 0}
--- !u!20 &20437103875467350
Camera:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1889434021946074}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!81 &81070402336043930
AudioListener:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1889434021946074}
m_Enabled: 1
--- !u!92 &92524413853108834
Behaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1889434021946074}
m_Enabled: 1
--- !u!114 &114306799516802978
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1889434021946074}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1ef9de564c5529c4faeace3894ec9e0b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!124 &124909405360866564
Behaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1889434021946074}
m_Enabled: 1

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c67fa24334c0f364cad8798522e92116
timeCreated: 1505745890
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 320b8ace903cab542b05f6b990f62ebe
folderAsset: yes
timeCreated: 1505749249
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -107,7 +107,7 @@ NavMeshSettings:
manualTileSize: 0 manualTileSize: 0
tileSize: 256 tileSize: 256
accuratePlacement: 0 accuratePlacement: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 23800000, guid: d7eb36ff892a3a7438b868633aac89d0, type: 2}
--- !u!1 &36514389 --- !u!1 &36514389
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -154,6 +154,64 @@ Transform:
m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1, m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1,
type: 2} type: 2}
m_PrefabInternal: {fileID: 377057537} m_PrefabInternal: {fileID: 377057537}
--- !u!1001 &339319393
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1265248828}
m_Modifications:
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalPosition.x
value: 4.5
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalPosition.y
value: -2.2143593
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalPosition.z
value: 2.512637
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalRotation.x
value: -0.12059054
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalRotation.y
value: -0.23296288
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalRotation.z
value: 0.30360317
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalRotation.w
value: 0.9159756
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1889434021946074, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalScale.x
value: 0.5857144
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalScale.y
value: 1.3149345
objectReference: {fileID: 0}
- target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2}
propertyPath: m_LocalScale.z
value: 0.3425328
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c67fa24334c0f364cad8798522e92116, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &377057537 --- !u!1001 &377057537
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -205,6 +263,11 @@ Transform:
m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1, m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1,
type: 2} type: 2}
m_PrefabInternal: {fileID: 1032732991} m_PrefabInternal: {fileID: 1032732991}
--- !u!4 &413537378 stripped
Transform:
m_PrefabParentObject: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116,
type: 2}
m_PrefabInternal: {fileID: 339319393}
--- !u!1001 &415128191 --- !u!1001 &415128191
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -320,6 +383,7 @@ GameObject:
- component: {fileID: 966385052} - component: {fileID: 966385052}
- component: {fileID: 966385056} - component: {fileID: 966385056}
- component: {fileID: 966385057} - component: {fileID: 966385057}
- component: {fileID: 966385058}
m_Layer: 0 m_Layer: 0
m_Name: Player m_Name: Player
m_TagString: Untagged m_TagString: Untagged
@ -387,8 +451,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.5, z: 0} m_LocalPosition: {x: 0, y: 0.5, z: 0}
m_LocalScale: {x: 0.5, y: 1, z: 0.5} m_LocalScale: {x: 0.5, y: 1, z: 0.5}
m_Children: m_Children: []
- {fileID: 1353476744}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -419,7 +482,27 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
particle: {fileID: 1057615597006810, guid: b25e969032ebb1f4089308db11ee93b1, type: 2} particle: {fileID: 1057615597006810, guid: b25e969032ebb1f4089308db11ee93b1, type: 2}
TransitionSpeed: 1 --- !u!195 &966385058
NavMeshAgent:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 966385051}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.5
m_Speed: 1.3
m_Acceleration: 20
avoidancePriority: 50
m_AngularSpeed: 0
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 0
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 1
m_BaseOffset: 0.5
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 2
--- !u!4 &984138133 stripped --- !u!4 &984138133 stripped
Transform: Transform:
m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1, m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1,
@ -558,6 +641,36 @@ Transform:
m_Father: {fileID: 1430923538} m_Father: {fileID: 1430923538}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1265248827
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1265248828}
m_Layer: 0
m_Name: Cameras
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1265248828
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1265248827}
m_LocalRotation: {x: 0.5, y: -0, z: -0, w: 0.8660254}
m_LocalPosition: {x: 0, y: 7.5, z: -5.5}
m_LocalScale: {x: 1, y: 0.625, z: 1.7499999}
m_Children:
- {fileID: 413537378}
- {fileID: 1353476744}
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1267399098 --- !u!1 &1267399098
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -699,12 +812,13 @@ GameObject:
serializedVersion: 5 serializedVersion: 5
m_Component: m_Component:
- component: {fileID: 1353476744} - component: {fileID: 1353476744}
- component: {fileID: 1353476745}
- component: {fileID: 1353476743} - component: {fileID: 1353476743}
- component: {fileID: 1353476742} - component: {fileID: 1353476742}
- component: {fileID: 1353476741} - component: {fileID: 1353476741}
- component: {fileID: 1353476740} - component: {fileID: 1353476740}
m_Layer: 0 m_Layer: 0
m_Name: Main Camera m_Name: Spy Camera
m_TagString: MainCamera m_TagString: MainCamera
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -773,13 +887,24 @@ Transform:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1353476739} m_GameObject: {fileID: 1353476739}
m_LocalRotation: {x: 0.5, y: 0, z: 0, w: 0.8660254} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 7, z: -11} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 1, z: 2} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 966385055} m_Father: {fileID: 1265248828}
m_RootOrder: 0 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0}
--- !u!114 &1353476745
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1353476739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5277ef44f4e110947993697cba721d20, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1430923537 --- !u!1 &1430923537
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -802,8 +927,8 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1430923537} m_GameObject: {fileID: 1430923537}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.37170354, y: 1.9782486, z: -0.23928754} m_LocalPosition: {x: 0.37170354, y: 6, z: -0.23928754}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 3, z: 1}
m_Children: m_Children:
- {fileID: 1141970351} - {fileID: 1141970351}
- {fileID: 1267399102} - {fileID: 1267399102}
@ -1007,7 +1132,7 @@ GameObject:
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 8
m_IsActive: 1 m_IsActive: 1
--- !u!23 &1873926729 --- !u!23 &1873926729
MeshRenderer: MeshRenderer:

Binary file not shown.

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d7eb36ff892a3a7438b868633aac89d0
timeCreated: 1505749249
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 23800000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GuardCameraController : MonoBehaviour {
private float camSens = 120.0f;
private float xRotation = 0.0f;
private float yRotation = 0.0f;
void Start () {
xRotation = transform.eulerAngles.y;
yRotation = transform.eulerAngles.x;
}
void Update () {
xRotation += Time.deltaTime * Input.GetAxis ("Horizontal") * camSens;
yRotation += Time.deltaTime * Input.GetAxis ("Vertical") * camSens;
transform.localRotation = Quaternion.AngleAxis (xRotation, Vector3.up);
transform.localRotation *= Quaternion.AngleAxis (yRotation, -Vector3.right);
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1ef9de564c5529c4faeace3894ec9e0b
timeCreated: 1505422157
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,27 +1,31 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using UnityEngine.AI;
public class PlayerController : MonoBehaviour public class PlayerController : MonoBehaviour
{ {
// Testing
public GameObject particle; public GameObject particle;
public float TransitionSpeed; // Player as a nav mesh agent
private Rigidbody rigi; private NavMeshAgent agent;
private Vector3 velocity = Vector3.zero;
void Start() void Start()
{ {
rigi = GetComponent<Rigidbody>(); agent = GetComponent<NavMeshAgent> ();
} }
void Update() void Update()
{ {
/* // WASD or Arrow keys movement
var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f; var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f; var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;
transform.Rotate(0, x, 0); transform.Rotate(0, x, 0);
transform.Translate(0, 0, z); transform.Translate(0, 0, z);
*/
RaycastHit hit; RaycastHit hit;
// Testing
if (Input.GetButtonDown("Fire1")) { if (Input.GetButtonDown("Fire1")) {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit)) { if (Physics.Raycast(ray, out hit)) {
@ -30,12 +34,13 @@ public class PlayerController : MonoBehaviour
Instantiate (particle, wantedPos, transform.rotation); Instantiate (particle, wantedPos, transform.rotation);
} }
} }
if (Input.GetButtonDown("Fire2")) { // Walking
else if (Input.GetButtonDown("Fire2")) {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit)) { if (Physics.Raycast(ray, out hit)) {
Vector3 wantedPos = hit.point; Vector3 wantedPos = hit.point;
wantedPos.y = 0.5f; wantedPos.y = 0.5f;
transform.position = Vector3.Lerp (transform.position, wantedPos, Time.deltaTime * TransitionSpeed); agent.destination = wantedPos;
} }
} }
} }

View file

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpyCameraController : MonoBehaviour {
private float camSens = 100.0f;
private float xRotation;
private Vector3 rotation;
void Start () {
rotation = new Vector3(0.0f, 0.0f, 0.0f);
}
void LateUpdate () {
xRotation = Time.deltaTime * Input.GetAxis ("Horizontal") * camSens;
transform.RotateAround (Vector3.zero, Vector3.up, -xRotation);
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5277ef44f4e110947993697cba721d20
timeCreated: 1505750194
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -13,9 +13,9 @@ InputManager:
positiveButton: right positiveButton: right
altNegativeButton: a altNegativeButton: a
altPositiveButton: d altPositiveButton: d
gravity: 3 gravity: 10
dead: 0.001 dead: 0.001
sensitivity: 3 sensitivity: 5
snap: 1 snap: 1
invert: 0 invert: 0
type: 0 type: 0
@ -29,9 +29,9 @@ InputManager:
positiveButton: up positiveButton: up
altNegativeButton: s altNegativeButton: s
altPositiveButton: w altPositiveButton: w
gravity: 3 gravity: 10
dead: 0.001 dead: 0.001
sensitivity: 3 sensitivity: 5
snap: 1 snap: 1
invert: 0 invert: 0
type: 0 type: 0