merged spy-ui-update

This commit is contained in:
Steven Leal 2017-11-30 12:55:47 -06:00
commit 7f20ebd211
19 changed files with 419 additions and 57 deletions

View file

@ -835,8 +835,7 @@ MonoBehaviour:
- {fileID: 11400000, guid: 01a3cf8545fc70f4c90095f144ac9b01, type: 2}
- {fileID: 11400000, guid: 7fc2c5ab600b7b64c832a95abea9589f, type: 2}
- {fileID: 11400000, guid: 80ca1bec2c07531428cf5a84624e44a4, type: 2}
spyInteractions:
- {fileID: 11400000, guid: 218e2ddac8223e349a855bdae23819ab, type: 2}
spyInteractions: []
currentState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2}
navMeshAgent: {fileID: 0}
animator: {fileID: 0}

View file

@ -0,0 +1,21 @@
%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: 11500000, guid: 3e84829fa9f855a42b9c35f7eb3b3dc0, type: 3}
m_Name: BugBust
m_EditorClassIdentifier:
interactionDescription: Plant bug
receiverDescription: N/A
initiatorAnimationTrigger: 9
objectAnimationTrigger: 0
result: 1
initialRotation: 0
objectInitialRotation: 0
interactionDistance: 1.5

View file

@ -0,0 +1,21 @@
%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: 11500000, guid: 3e84829fa9f855a42b9c35f7eb3b3dc0, type: 3}
m_Name: CheckPlant
m_EditorClassIdentifier:
interactionDescription: check plant for secrets
receiverDescription: N/A
initiatorAnimationTrigger: 9
objectAnimationTrigger: 0
result: 1
initialRotation: 0
objectInitialRotation: 0
interactionDistance: 1.5

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6a5566273e76c4d4cbd67e27b6e2f927
timeCreated: 1507179270
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -9,7 +9,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3e84829fa9f855a42b9c35f7eb3b3dc0, type: 3}
m_Name: HideMessage
m_Name: HideMessageInBookshelf
m_EditorClassIdentifier:
interactionDescription: hide a secret message
receiverDescription: N/A

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 192350e7a3ce4404e9436c6c3b800405
timeCreated: 1507179270
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -5,7 +5,7 @@ public class InitiatedInteractionDecision : Decision
{
public override bool Decide(StateController controller)
{
return Input.GetKeyDown(KeyCode.E) &&
return controller.SelectedInteraction != null &&
InteractionPanelController.InteractionPrompted() &&
controller.SelectedObject != null &&
controller.SelectedInteraction != null;

View file

@ -9,9 +9,7 @@ public class YouAcceptedInteractionDecision : Decision
{
public override bool Decide(StateController controller)
{
if (Input.GetKeyDown(KeyCode.E))
return controller.Interactor != null;
return false;
return controller.SelectedInteraction != null && controller.Interactor != null;
}
}

View file

@ -29,7 +29,7 @@ public class MissionTracker : Photon.PunBehaviour
const float GUARD_NOTIFICATION_DELAY = 5.0f;
const float GUARD_NOTIFICATION_TIME = 10.0f;
const float MISSION_NOTIFICATION_TIME = 20.0f;
const float MISSION_NOTIFICATION_TIME = 10.0f;
private static MissionTracker mSingleton;
@ -131,12 +131,24 @@ public class MissionTracker : Photon.PunBehaviour
"Enemy forces have planted listening devices somewhere on the premises!"
);*/
mMissionLog["HideMessage"] = new Mission(
mMissionLog["HideMessageInBookshelf"] = new Mission(
"Plant critical intelligence in the designated book.",
"One of the staff saw someone suspicious over by the bookcases. " +
"The enemy moves among us."
);
mMissionLog["BugBust"] = new Mission(
"Plant a bug on the bust.",
"One of the staff saw someone suspicious over by the bookcases. " +
"The enemy moves among us."
);
mMissionLog["CheckPlant"] = new Mission(
"Check for secrets hidden in the plant.",
"One of the staff saw someone suspicious over by the bookcases. " +
"The enemy moves among us."
);
/*mMissionLog["bathroom_kill"] = new Mission(
"Assassinate Knight-Captain Brystol in the bathroom.",
"Our men found Knight-Captain Brystol dead in the bathroom. " +

View file

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InteractionButtonProperties : MonoBehaviour {
public Text text;
public Interaction interaction;
void Awake () {
if (transform.childCount > 0)
{
text = transform.GetChild(0).GetComponent<Text>();
}
if (text == null)
Debug.LogError("No text child object iside of this interaction button");
}
public void SetInteraction(Interaction inter)
{
interaction = inter;
text.text = interaction.interactionDescription;
}
public void InteractionSelected()
{
Debug.Log("Selected interaction " + interaction.name + " from button " + name);
InteractionPanelController.ActivePanel.SetInteraction(interaction);
}
}

View file

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

View file

@ -5,35 +5,23 @@ using UnityEngine.UI;
public class InteractionPanelController : MonoBehaviour {
// One choice vars
[SerializeField]
private Text interactionText;
GameObject oneChoicePanel;
[SerializeField]
private GameObject mainPanel;
InteractionButtonProperties interactionButton;
// two choices vars
[SerializeField]
private Dropdown interactionsDropdown;
GameObject choicePanel;
[SerializeField]
private GameObject interactionItemPrefab;
InteractionButtonProperties spyButton;
[SerializeField]
private GameObject requestPanel;
[SerializeField]
private Text requestedInteractionText;
InteractionButtonProperties npcButton;
private static InteractionPanelController activePanel;
private StateController _controller;
public class InteractionData : Dropdown.OptionData
{
public Interaction interaction;
public bool isSpyInteraction;
public InteractionData(Interaction interaction, bool isSpyInteraction)
{
this.interaction = interaction;
this.isSpyInteraction = isSpyInteraction;
text = interaction.interactionDescription;
if (isSpyInteraction)
text = text + " (Spy)";
}
}
void Start()
{
ActivePanel = this;
@ -43,48 +31,40 @@ public class InteractionPanelController : MonoBehaviour {
public void SelectInteractionReveal(StateController controller)
{
_controller = controller;
if (mainPanel.activeInHierarchy)
if (oneChoicePanel.activeInHierarchy || choicePanel.activeInHierarchy)
return;
interactionsDropdown.ClearOptions();
var optionsList = new List<Dropdown.OptionData>();
foreach (Interaction interaction in controller.SelectedObject.interactions)
int randomInt = (int)(Random.value * controller.SelectedObject.interactions.Length);
Interaction randomNpcInteraction = controller.SelectedObject.interactions[randomInt];
if (controller.SelectedObject.spyInteractions.Length == 0)
{
var data = new InteractionData(interaction, false);
optionsList.Add(data);
oneChoicePanel.SetActive(true);
interactionButton.SetInteraction(randomNpcInteraction);
}
foreach (Interaction interaction in controller.SelectedObject.spyInteractions)
else
{
var data = new InteractionData(interaction, true);
optionsList.Add(data);
choicePanel.SetActive(true);
Interaction spyInteraction = controller.SelectedObject.spyInteractions[0];
spyButton.SetInteraction(spyInteraction);
npcButton.SetInteraction(randomNpcInteraction);
}
interactionsDropdown.AddOptions(optionsList);
if (interactionsDropdown.value > interactionsDropdown.options.Count)
interactionsDropdown.value = 0;
_controller.SelectedInteraction = ((InteractionData)(interactionsDropdown.options[interactionsDropdown.value])).interaction;
ActivePanel.mainPanel.SetActive(true);
}
public void SetSelectedInteraction()
{
_controller.SelectedInteraction = ((InteractionData)(interactionsDropdown.options[interactionsDropdown.value])).interaction;
}
public void AcceptInteractionReveal(StateController controller)
{
_controller = controller;
requestPanel.SetActive(true);
oneChoicePanel.SetActive(true);
choicePanel.SetActive(false);
string description = controller.Interactor.SelectedInteraction.receiverDescription;
requestedInteractionText.GetComponent<Text>().text = "Press 'E' to " + description;
interactionButton.text.text = description;
interactionButton.SetInteraction(controller.Interactor.SelectedInteraction);
}
public void Hide()
{
mainPanel.SetActive(false);
requestPanel.SetActive(false);
interactionsDropdown.Hide();
choicePanel.SetActive(false);
oneChoicePanel.SetActive(false);
}
public static InteractionPanelController ActivePanel
@ -109,6 +89,27 @@ public class InteractionPanelController : MonoBehaviour {
public static bool InteractionPrompted()
{
return ActivePanel.mainPanel.activeInHierarchy;
return ActivePanel.choicePanel.activeInHierarchy || ActivePanel.oneChoicePanel.activeInHierarchy;
}
public void SetInteraction(Interaction interaction)
{
_controller.SelectedInteraction = interaction;
}
/*
public bool WasInteractionInitiated()
{
if (_initiatedInteraction)
{
_initiatedInteraction = false;
return _initiatedInteraction;
}
return false;
}
public void InitiatedInteraction()
{
_initiatedInteraction = true;
}*/
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 KiB

View file

@ -0,0 +1,82 @@
fileFormatVersion: 2
guid: 9d5216dabd9a33a46a591a9cca342331
timeCreated: 1512054027
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 KiB

View file

@ -0,0 +1,82 @@
fileFormatVersion: 2
guid: 0b25834a6d9be464da63a3ed49cdf485
timeCreated: 1512054027
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View file

@ -0,0 +1,82 @@
fileFormatVersion: 2
guid: 2b1b3401408959b4eb46d7d11d15dcc0
timeCreated: 1512054191
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant: