almost finished guard camera raycasting
This commit is contained in:
parent
b90f683105
commit
edc557811f
18 changed files with 105 additions and 79 deletions
Binary file not shown.
BIN
Project Undercover/Assets/Models/Blender/bust.blend1
Normal file
BIN
Project Undercover/Assets/Models/Blender/bust.blend1
Normal file
Binary file not shown.
|
@ -1,7 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e496172999d202948be110cc90eba6e2
|
guid: 5c64151264d0426479cf614cf8110ebd
|
||||||
folderAsset: yes
|
timeCreated: 1510253917
|
||||||
timeCreated: 1509473891
|
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
userData:
|
userData:
|
Binary file not shown.
Binary file not shown.
|
@ -21,7 +21,7 @@ GameObject:
|
||||||
- component: {fileID: 4142260045970492}
|
- component: {fileID: 4142260045970492}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: CameraRig
|
m_Name: CameraRig
|
||||||
m_TagString: Untagged
|
m_TagString: CameraRig
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!114 &11400000
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 0}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 0}
|
|
||||||
m_Name: NpcColors
|
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::NpcColors
|
|
||||||
colors:
|
|
||||||
- {r: 1, g: 0, b: 0, a: 0}
|
|
||||||
- {r: 0, g: 1, b: 0, a: 0}
|
|
||||||
- {r: 0, g: 0, b: 1, a: 0}
|
|
|
@ -1,9 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 0ca93fb1ceb40684f8b400eb4d65bffe
|
|
||||||
timeCreated: 1507940030
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
mainObjectFileID: 11400000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -73,4 +73,6 @@ MonoBehaviour:
|
||||||
- RemovePlayer
|
- RemovePlayer
|
||||||
- CaughtSpyRPC
|
- CaughtSpyRPC
|
||||||
- GuardCaughtNPCRPC
|
- GuardCaughtNPCRPC
|
||||||
|
- ReplaceNPCWithSpyRPC
|
||||||
|
- ReplaceSpyRPC
|
||||||
DisableAutoOpenWizard: 1
|
DisableAutoOpenWizard: 1
|
||||||
|
|
|
@ -117,9 +117,10 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 40329370}
|
- component: {fileID: 40329370}
|
||||||
- component: {fileID: 40329369}
|
- component: {fileID: 40329369}
|
||||||
|
- component: {fileID: 40329371}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: GameManager
|
m_Name: GameManager
|
||||||
m_TagString: Untagged
|
m_TagString: GameManager
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
@ -141,15 +142,7 @@ MonoBehaviour:
|
||||||
cameraRigPrefab: {fileID: 1009033979625728, guid: 1764211b5690c164d82aa46fa4ec707d,
|
cameraRigPrefab: {fileID: 1009033979625728, guid: 1764211b5690c164d82aa46fa4ec707d,
|
||||||
type: 2}
|
type: 2}
|
||||||
numNpcs: 10
|
numNpcs: 10
|
||||||
spyMissionsComplete: 0
|
|
||||||
waitBetweenMissions: 5
|
|
||||||
onMissionCooldown: 0
|
|
||||||
missionsCompleteText: {fileID: 0}
|
|
||||||
winPanel: {fileID: 0}
|
|
||||||
guardPanel: {fileID: 0}
|
|
||||||
spyPanel: {fileID: 0}
|
|
||||||
guardCameraPanel: {fileID: 164040928}
|
guardCameraPanel: {fileID: 164040928}
|
||||||
winText: {fileID: 0}
|
|
||||||
--- !u!4 &40329370
|
--- !u!4 &40329370
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -163,6 +156,31 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 12
|
m_RootOrder: 12
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &40329371
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 40329368}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
ownerId: 0
|
||||||
|
group: 0
|
||||||
|
OwnerShipWasTransfered: 0
|
||||||
|
prefixBackup: -1
|
||||||
|
synchronization: 0
|
||||||
|
onSerializeTransformOption: 3
|
||||||
|
onSerializeRigidBodyOption: 2
|
||||||
|
ownershipTransfer: 0
|
||||||
|
ObservedComponents: []
|
||||||
|
ObservedComponentsFoldoutOpen: 1
|
||||||
|
viewIdField: 7
|
||||||
|
instantiationId: 7
|
||||||
|
currentMasterID: -1
|
||||||
|
isRuntimeInstantiated: 0
|
||||||
--- !u!1 &81075120
|
--- !u!1 &81075120
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1229,6 +1247,10 @@ Prefab:
|
||||||
propertyPath: m_Layer
|
propertyPath: m_Layer
|
||||||
value: 10
|
value: 10
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 100000, guid: 0bce433961afa4d488cf2e08bff4f86a, type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_ParentPrefab: {fileID: 100100000, guid: 0bce433961afa4d488cf2e08bff4f86a, type: 3}
|
m_ParentPrefab: {fileID: 100100000, guid: 0bce433961afa4d488cf2e08bff4f86a, type: 3}
|
||||||
m_IsPrefabParent: 0
|
m_IsPrefabParent: 0
|
||||||
|
@ -1268,12 +1290,12 @@ MonoBehaviour:
|
||||||
group: 0
|
group: 0
|
||||||
OwnerShipWasTransfered: 0
|
OwnerShipWasTransfered: 0
|
||||||
prefixBackup: -1
|
prefixBackup: -1
|
||||||
synchronization: 3
|
synchronization: 0
|
||||||
onSerializeTransformOption: 3
|
onSerializeTransformOption: 3
|
||||||
onSerializeRigidBodyOption: 2
|
onSerializeRigidBodyOption: 2
|
||||||
ownershipTransfer: 0
|
ownershipTransfer: 0
|
||||||
ObservedComponents:
|
ObservedComponents:
|
||||||
- {fileID: 284817582}
|
- {fileID: 0}
|
||||||
ObservedComponentsFoldoutOpen: 1
|
ObservedComponentsFoldoutOpen: 1
|
||||||
viewIdField: 6
|
viewIdField: 6
|
||||||
instantiationId: 6
|
instantiationId: 6
|
||||||
|
@ -1444,6 +1466,10 @@ Prefab:
|
||||||
propertyPath: m_StaticEditorFlags
|
propertyPath: m_StaticEditorFlags
|
||||||
value: 4294967295
|
value: 4294967295
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 100000, guid: cc86ddd814bb12f43b57ded5958a2dd6, type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_ParentPrefab: {fileID: 100100000, guid: cc86ddd814bb12f43b57ded5958a2dd6, type: 3}
|
m_ParentPrefab: {fileID: 100100000, guid: cc86ddd814bb12f43b57ded5958a2dd6, type: 3}
|
||||||
m_IsPrefabParent: 0
|
m_IsPrefabParent: 0
|
||||||
|
@ -1483,12 +1509,12 @@ MonoBehaviour:
|
||||||
group: 0
|
group: 0
|
||||||
OwnerShipWasTransfered: 0
|
OwnerShipWasTransfered: 0
|
||||||
prefixBackup: -1
|
prefixBackup: -1
|
||||||
synchronization: 3
|
synchronization: 0
|
||||||
onSerializeTransformOption: 3
|
onSerializeTransformOption: 3
|
||||||
onSerializeRigidBodyOption: 2
|
onSerializeRigidBodyOption: 2
|
||||||
ownershipTransfer: 0
|
ownershipTransfer: 0
|
||||||
ObservedComponents:
|
ObservedComponents:
|
||||||
- {fileID: 316942571}
|
- {fileID: 0}
|
||||||
ObservedComponentsFoldoutOpen: 1
|
ObservedComponentsFoldoutOpen: 1
|
||||||
viewIdField: 5
|
viewIdField: 5
|
||||||
instantiationId: 5
|
instantiationId: 5
|
||||||
|
|
Binary file not shown.
|
@ -1,9 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 3b44e343791674a4692df18a304a5e9d
|
|
||||||
timeCreated: 1509473920
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
mainObjectFileID: 23800000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -106,7 +106,7 @@ public class GuardController : Photon.PunBehaviour {
|
||||||
}
|
}
|
||||||
else if (hit.transform.gameObject.tag == "Spy")
|
else if (hit.transform.gameObject.tag == "Spy")
|
||||||
{
|
{
|
||||||
ScorePanelController.CaughtSpy();
|
ScorePanelController.CaughtSpy(hit.transform.gameObject.GetPhotonView().viewID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,23 +2,15 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
public class GameManager : Photon.PunBehaviour {
|
public class GameManager : Photon.PunBehaviour {
|
||||||
|
|
||||||
public GameObject guardController;
|
public GameObject guardController;
|
||||||
public GameObject spyPrefab, NPCPrefab, cameraRigPrefab;
|
public GameObject spyPrefab, NPCPrefab, cameraRigPrefab;
|
||||||
public int numNpcs = 9;
|
public int numNpcs = 9;
|
||||||
public int spyMissionsComplete = 0;
|
|
||||||
public float waitBetweenMissions = 5.0f;
|
|
||||||
public bool onMissionCooldown = false;
|
|
||||||
public Text missionsCompleteText;
|
|
||||||
public GameObject winPanel;
|
|
||||||
public GameObject guardPanel;
|
|
||||||
public GameObject spyPanel;
|
|
||||||
public GameObject guardCameraPanel;
|
public GameObject guardCameraPanel;
|
||||||
public Text winText;
|
private static GameManager _activeManager = null;
|
||||||
private int numOfMissions = 3;
|
|
||||||
|
|
||||||
public override void OnLeftRoom()
|
public override void OnLeftRoom()
|
||||||
{
|
{
|
||||||
|
@ -43,8 +35,21 @@ public class GameManager : Photon.PunBehaviour {
|
||||||
PhotonNetwork.LeaveRoom();
|
PhotonNetwork.LeaveRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GameManager ActiveManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _activeManager;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
if (_activeManager == null)
|
||||||
|
_activeManager = this;
|
||||||
|
else
|
||||||
|
Debug.LogError("More than one game manager in the scene!");
|
||||||
|
|
||||||
if (PersistantPlayerSettings.character == PersistantPlayerSettings.Character.Guard)
|
if (PersistantPlayerSettings.character == PersistantPlayerSettings.Character.Guard)
|
||||||
{
|
{
|
||||||
guardController.SetActive(true);
|
guardController.SetActive(true);
|
||||||
|
@ -71,9 +76,33 @@ public class GameManager : Photon.PunBehaviour {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[PunRPC]
|
public List<StateController> GetNpcs()
|
||||||
void SpawnNPC(Vector3 pos)
|
|
||||||
{
|
{
|
||||||
Instantiate(NPCPrefab, pos, Quaternion.identity);
|
var npcList = new List<StateController>();
|
||||||
|
foreach (GameObject obj in GameObject.FindGameObjectsWithTag("NPC"))
|
||||||
|
{
|
||||||
|
npcList.Add(obj.GetComponent<StateController>());
|
||||||
|
}
|
||||||
|
return npcList;
|
||||||
|
}
|
||||||
|
|
||||||
|
[PunRPC]
|
||||||
|
void ReplaceNPCWithSpyRPC(int spyId, int npcId)
|
||||||
|
{
|
||||||
|
var randNPC = PhotonView.Find(npcId);
|
||||||
|
|
||||||
|
// Replace NPC with Spy
|
||||||
|
PhotonView spyView = PhotonView.Find(spyId);
|
||||||
|
if (spyView && spyView.isMine)
|
||||||
|
{
|
||||||
|
PhotonNetwork.Destroy(spyView.gameObject);
|
||||||
|
var spy = PhotonNetwork.Instantiate(spyPrefab.name, randNPC.transform.position, randNPC.transform.rotation, 0);
|
||||||
|
GameObject cameraRig = GameObject.FindGameObjectWithTag("CameraRig");
|
||||||
|
cameraRig.GetComponentInChildren<ThirdPersonCameraController>().SetTarget(spy.transform);
|
||||||
|
}
|
||||||
|
if (PhotonNetwork.isMasterClient)
|
||||||
|
{
|
||||||
|
PhotonNetwork.Destroy(randNPC.gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[CreateAssetMenu(menuName = "Colors/NpcColors")]
|
|
||||||
public static class NpcColors {
|
public static class NpcColors {
|
||||||
|
|
||||||
private static List<int> remainingIndices;
|
private static List<int> remainingIndices;
|
||||||
|
|
|
@ -53,14 +53,12 @@ public class InteractionPanelController : MonoBehaviour {
|
||||||
var data = new InteractionData(interaction, false);
|
var data = new InteractionData(interaction, false);
|
||||||
optionsList.Add(data);
|
optionsList.Add(data);
|
||||||
}
|
}
|
||||||
if (true || controller.SelectedObject.CompareTag("Spy"))
|
|
||||||
{
|
|
||||||
foreach (Interaction interaction in controller.SelectedObject.spyInteractions)
|
foreach (Interaction interaction in controller.SelectedObject.spyInteractions)
|
||||||
{
|
{
|
||||||
var data = new InteractionData(interaction, true);
|
var data = new InteractionData(interaction, true);
|
||||||
optionsList.Add(data);
|
optionsList.Add(data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
interactionsDropdown.AddOptions(optionsList);
|
interactionsDropdown.AddOptions(optionsList);
|
||||||
if (interactionsDropdown.value > interactionsDropdown.options.Count)
|
if (interactionsDropdown.value > interactionsDropdown.options.Count)
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class ScorePanelController : Photon.PunBehaviour {
|
||||||
public Text _timerText;
|
public Text _timerText;
|
||||||
public Image _guardScore, _spyScore;
|
public Image _guardScore, _spyScore;
|
||||||
|
|
||||||
private int _numOfMissions = 3, _maxGuardPoints = 3;
|
private int _numOfMissions = 5, _maxGuardPoints = 5;
|
||||||
private int _missionsComplete = 0, _numGuardPoints = 0;
|
private int _missionsComplete = 0, _numGuardPoints = 0;
|
||||||
private float waitBetweenMissions = 5.0f;
|
private float waitBetweenMissions = 5.0f;
|
||||||
private bool onMissionCooldown = false;
|
private bool onMissionCooldown = false;
|
||||||
|
@ -34,17 +34,20 @@ public class ScorePanelController : Photon.PunBehaviour {
|
||||||
{
|
{
|
||||||
if (ActivePanel.onMissionCooldown)
|
if (ActivePanel.onMissionCooldown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActivePanel.photonView.RPC("CompleteMissionRPC", PhotonTargets.All);
|
ActivePanel.photonView.RPC("CompleteMissionRPC", PhotonTargets.All);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CaughtSpy()
|
public static void CaughtSpy(int spyId)
|
||||||
{
|
{
|
||||||
ActivePanel.photonView.RPC("CaughtSpyRPC", PhotonTargets.All);
|
if (ActivePanel.onMissionCooldown)
|
||||||
|
return;
|
||||||
|
ActivePanel.photonView.RPC("CaughtSpyRPC", PhotonTargets.All, spyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardCaughtNPC()
|
public static void GuardCaughtNPC()
|
||||||
{
|
{
|
||||||
|
if (ActivePanel.onMissionCooldown)
|
||||||
|
return;
|
||||||
ActivePanel.photonView.RPC("GuardCaughtNPCRPC", PhotonTargets.All);
|
ActivePanel.photonView.RPC("GuardCaughtNPCRPC", PhotonTargets.All);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,12 +171,17 @@ public class ScorePanelController : Photon.PunBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
[PunRPC]
|
[PunRPC]
|
||||||
void CaughtSpyRPC()
|
void CaughtSpyRPC(int spyId)
|
||||||
{
|
{
|
||||||
Debug.Log("Spy Caught!");
|
Debug.Log("Spy Caught!");
|
||||||
_numGuardPoints++;
|
_numGuardPoints++;
|
||||||
StartCoroutine(MissionCooldown());
|
StartCoroutine(MissionCooldown());
|
||||||
StartCoroutine(IncreaseScoreBarAnimation(_guardScore, (float)_numGuardPoints / _maxGuardPoints));
|
StartCoroutine(IncreaseScoreBarAnimation(_guardScore, (float)_numGuardPoints / _maxGuardPoints));
|
||||||
|
|
||||||
|
// Get Random NPC
|
||||||
|
var npcs = GameManager.ActiveManager.GetNpcs();
|
||||||
|
int randInt = (int)(UnityEngine.Random.value * npcs.Count);
|
||||||
|
GameManager.ActiveManager.photonView.RPC("ReplaceNPCWithSpyRPC", PhotonTargets.All, spyId, npcs[randInt].photonView.viewID);
|
||||||
}
|
}
|
||||||
|
|
||||||
[PunRPC]
|
[PunRPC]
|
||||||
|
@ -191,5 +199,4 @@ public class ScorePanelController : Photon.PunBehaviour {
|
||||||
WinAnimationController.ActiveController.PlayWinAnimation(guardsOrSpies);
|
WinAnimationController.ActiveController.PlayWinAnimation(guardsOrSpies);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ TagManager:
|
||||||
- NPC
|
- NPC
|
||||||
- GuardController
|
- GuardController
|
||||||
- GuardPanel
|
- GuardPanel
|
||||||
|
- CameraRig
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|
Reference in a new issue