Human interactor inside hall
This commit is contained in:
File diff suppressed because it is too large
Load Diff
8
Assets/Game/Materials.meta
Normal file
8
Assets/Game/Materials.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b57d2a0641b9779e8a3678443deed9e2
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
124
Assets/Game/Materials/ShopBtn.mat
Normal file
124
Assets/Game/Materials/ShopBtn.mat
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-3282878943659613903
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 4
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: ShopBtn
|
||||||
|
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: 2000
|
||||||
|
stringTagMap:
|
||||||
|
RenderType: Opaque
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BaseMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _SpecGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_Lightmaps:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_LightmapsInd:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_ShadowMasks:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- _AlphaClip: 0
|
||||||
|
- _Blend: 0
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _ClearCoatMask: 0
|
||||||
|
- _ClearCoatSmoothness: 0
|
||||||
|
- _Cull: 2
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailAlbedoMapScale: 1
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _EnvironmentReflections: 1
|
||||||
|
- _GlossMapScale: 0
|
||||||
|
- _Glossiness: 0
|
||||||
|
- _GlossyReflections: 0
|
||||||
|
- _Metallic: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.005
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _ReceiveShadows: 1
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _Surface: 0
|
||||||
|
- _WorkflowMode: 1
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
8
Assets/Game/Materials/ShopBtn.mat.meta
Normal file
8
Assets/Game/Materials/ShopBtn.mat.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cb979a3b590e79840a8d92957734917e
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@ public class Building : MonoBehaviour
|
|||||||
public BuildingData buildingData;
|
public BuildingData buildingData;
|
||||||
public int curLevel;
|
public int curLevel;
|
||||||
public Outline[] outlines;
|
public Outline[] outlines;
|
||||||
|
public bool autoGetOutlines = true;
|
||||||
|
|
||||||
public DateTime lastCollected;
|
public DateTime lastCollected;
|
||||||
|
|
||||||
void OnDrawGizmos() {
|
void OnDrawGizmos() {
|
||||||
@@ -17,7 +19,7 @@ public class Building : MonoBehaviour
|
|||||||
|
|
||||||
void Awake(){
|
void Awake(){
|
||||||
//if(outline == null){outline = GetComponent<Outline>();}
|
//if(outline == null){outline = GetComponent<Outline>();}
|
||||||
outlines = GetComponentsInChildren<Outline>();
|
if(autoGetOutlines){ outlines = GetComponentsInChildren<Outline>(); }
|
||||||
ToggleOutlines(false);
|
ToggleOutlines(false);
|
||||||
Selector.OnSelectedChanged.AddListener(OnSelectedChanged);
|
Selector.OnSelectedChanged.AddListener(OnSelectedChanged);
|
||||||
transform.tag = "Building";
|
transform.tag = "Building";
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public class BuildingData : ScriptableObject
|
|||||||
new BuildingLevel(1,new List<BuildingStat>(), 1000)
|
new BuildingLevel(1,new List<BuildingStat>(), 1000)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
public string description;
|
public string description;
|
||||||
public bool collectable;
|
public bool collectable;
|
||||||
public CollectablesData.ResourceType resourceType;
|
public CollectablesData.ResourceType resourceType;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class CameraManager : MonoBehaviour
|
|||||||
|
|
||||||
|
|
||||||
public void JoinMainHall(){
|
public void JoinMainHall(){
|
||||||
Selector.enabled=false;
|
Selector.insideHall=true;
|
||||||
Selector.selectBuilding(null);
|
Selector.selectBuilding(null);
|
||||||
leaveHallBtn.SetActive(true);
|
leaveHallBtn.SetActive(true);
|
||||||
defaultPos = cam.position;
|
defaultPos = cam.position;
|
||||||
@@ -58,7 +58,7 @@ public class CameraManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void LeaveMainHall(){
|
public void LeaveMainHall(){
|
||||||
Selector.enabled=true;
|
Selector.insideHall=false;
|
||||||
leaveHallBtn.SetActive(false);
|
leaveHallBtn.SetActive(false);
|
||||||
StartCoroutine(ToggleMainHallCamera(false));
|
StartCoroutine(ToggleMainHallCamera(false));
|
||||||
}
|
}
|
||||||
|
|||||||
45
Assets/Game/Scripts/HumanInteractor.cs
Normal file
45
Assets/Game/Scripts/HumanInteractor.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
public class HumanInteractor : MonoBehaviour
|
||||||
|
{
|
||||||
|
public GameObject[] showingObjects;
|
||||||
|
public UnityEvent OnInteraction;
|
||||||
|
public UnityEvent OnClose;
|
||||||
|
private bool showing;
|
||||||
|
[SerializeField]
|
||||||
|
public bool Showing => showing;
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
Selector.OnSelectedChanged.AddListener(OnSelectionChanged);
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSelectionChanged(){
|
||||||
|
Toggle(Selector.selectedHuman==this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Toggle(){
|
||||||
|
showing = !showing;
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Toggle(bool value){
|
||||||
|
showing = value;
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Refresh(){
|
||||||
|
foreach(GameObject go in showingObjects){
|
||||||
|
go.SetActive(showing);
|
||||||
|
}
|
||||||
|
if(!showing){
|
||||||
|
OnClose.Invoke();
|
||||||
|
}else{
|
||||||
|
OnInteraction.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Game/Scripts/HumanInteractor.cs.meta
Normal file
11
Assets/Game/Scripts/HumanInteractor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6b405ebb2bab8172fa7c1cca9a228d73
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -24,9 +24,16 @@ public class WorldItemSelector : MonoBehaviour
|
|||||||
// //Selector.selectBuilding(null);
|
// //Selector.selectBuilding(null);
|
||||||
// }
|
// }
|
||||||
Selector.selectBuilding(selectedB);
|
Selector.selectBuilding(selectedB);
|
||||||
|
|
||||||
|
if(Selector.insideHall){
|
||||||
|
HumanInteractor interactor = hit.collider.GetComponent<HumanInteractor>();
|
||||||
|
Selector.selectHuman(interactor);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
Selector.selectBuilding(null);
|
Selector.selectBuilding(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3? GetTouchingWorldPoint(Vector2 screenPoint){
|
public Vector3? GetTouchingWorldPoint(Vector2 screenPoint){
|
||||||
@@ -109,17 +116,26 @@ public class WorldItemSelector : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Selector{
|
public static class Selector{
|
||||||
public static bool enabled=true;
|
//public static bool enabled=true;
|
||||||
|
public static bool insideHall = false;
|
||||||
public static bool movingPointValid;
|
public static bool movingPointValid;
|
||||||
public static Building movingBuilding;
|
public static Building movingBuilding;
|
||||||
public static bool isMovingBuilding => movingBuilding!=null;
|
public static bool isMovingBuilding => movingBuilding!=null;
|
||||||
public static Building selectedBuilding;
|
public static Building selectedBuilding;
|
||||||
public static BuildingData selectedData => selectedBuilding.buildingData;
|
public static BuildingData selectedData => selectedBuilding.buildingData;
|
||||||
|
|
||||||
|
public static HumanInteractor selectedHuman;
|
||||||
public static UnityEvent OnSelectedChanged = new UnityEvent();
|
public static UnityEvent OnSelectedChanged = new UnityEvent();
|
||||||
|
|
||||||
public static void selectBuilding(Building e){
|
public static void selectBuilding(Building e){
|
||||||
selectedBuilding = e;
|
selectedBuilding = e;
|
||||||
if(!enabled){selectedBuilding=null;}
|
if(insideHall){selectedBuilding=null;}
|
||||||
|
OnSelectedChanged.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void selectHuman(HumanInteractor e){
|
||||||
|
selectedHuman = e;
|
||||||
|
if(!insideHall){selectedHuman=null;}
|
||||||
OnSelectedChanged.Invoke();
|
OnSelectedChanged.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
UPF.sln
13
UPF.sln
@@ -1,18 +1,19 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
# Visual Studio 2010
|
# Visual Studio 2010
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.com.consulo.ide.Editor", "Unity.com.consulo.ide.Editor.csproj", "{f3918ae7-b834-5fa8-e000-01833c449c8e}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{f3918ae7-b834-5fa8-e000-01833c449c8e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{f3918ae7-b834-5fa8-e000-01833c449c8e}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user