added: player environment manager, and accompanying aline and odin changes
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
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: 1726182683, guid: a4865f1ab4504ed8a368670db22f409c, type: 3}
|
||||||
|
m_Name: AOTGenerationConfig
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
automateBeforeBuilds: 0
|
||||||
|
deleteDllAfterBuilds: 1
|
||||||
|
AutomateForAllAOTPlatforms: 1
|
||||||
|
automateForPlatforms: 0900000014000000
|
||||||
|
supportSerializedTypes: []
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 516c69467762d38429c69cc7107c0555
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
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: 772478971, guid: a4865f1ab4504ed8a368670db22f409c, type: 3}
|
||||||
|
m_Name: ColorPaletteManager
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
colorPalettes:
|
||||||
|
- name: Country
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.776, g: 0.651, b: 0.349, a: 1}
|
||||||
|
- {r: 0.863, g: 0.761, b: 0.631, a: 1}
|
||||||
|
- {r: 0.91, g: 0.831, b: 0.686, a: 1}
|
||||||
|
- {r: 0.961, g: 0.902, b: 0.788, a: 1}
|
||||||
|
- {r: 0.753, g: 0.714, b: 0.667, a: 1}
|
||||||
|
- {r: 0.478, g: 0.573, b: 0.431, a: 1}
|
||||||
|
- {r: 0.314, g: 0.427, b: 0.31, a: 1}
|
||||||
|
- {r: 0.596, g: 0.345, b: 0.235, a: 1}
|
||||||
|
- {r: 0.545, g: 0.329, b: 0.318, a: 1}
|
||||||
|
- {r: 0.647, g: 0.204, b: 0.227, a: 1}
|
||||||
|
- {r: 0.435, g: 0.161, b: 0.063, a: 1}
|
||||||
|
- {r: 0.357, g: 0.333, b: 0.278, a: 1}
|
||||||
|
- {r: 0.976, g: 0.98, b: 0.961, a: 1}
|
||||||
|
- {r: 0.165, g: 0.271, b: 0.11, a: 1}
|
||||||
|
- name: Beach
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.996, g: 0.906, b: 0.459, a: 1}
|
||||||
|
- {r: 0.314, g: 0.592, b: 0.035, a: 1}
|
||||||
|
- {r: 0.486, g: 0.953, b: 0.875, a: 1}
|
||||||
|
- {r: 0.996, g: 0.82, b: 0.212, a: 1}
|
||||||
|
- {r: 1, g: 0.769, b: 0.165, a: 1}
|
||||||
|
- {r: 0.804, g: 0.835, b: 0.753, a: 1}
|
||||||
|
- {r: 1, g: 0.769, b: 0.165, a: 1}
|
||||||
|
- {r: 1, g: 0.702, b: 0.063, a: 1}
|
||||||
|
- {r: 1, g: 0.898, b: 0.569, a: 1}
|
||||||
|
- name: Fall
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.82, g: 0.722, b: 0.318, a: 1}
|
||||||
|
- {r: 0.537, g: 0.192, b: 0.153, a: 1}
|
||||||
|
- {r: 0.996, g: 0.812, b: 0.012, a: 1}
|
||||||
|
- {r: 1, g: 0.431, b: 0.02, a: 1}
|
||||||
|
- {r: 0.937, g: 0.267, b: 0.094, a: 1}
|
||||||
|
- {r: 0.42, g: 0.212, b: 0.18, a: 1}
|
||||||
|
- {r: 0.992, g: 0.651, b: 0.004, a: 1}
|
||||||
|
- {r: 0.89, g: 0.353, b: 0.086, a: 1}
|
||||||
|
- {r: 1, g: 0.443, b: 0.004, a: 1}
|
||||||
|
- {r: 0.682, g: 0.275, b: 0.137, a: 1}
|
||||||
|
- {r: 0.306, g: 0.231, b: 0.114, a: 1}
|
||||||
|
- {r: 0.384, g: 0.416, b: 0.082, a: 1}
|
||||||
|
- {r: 0.165, g: 0.157, b: 0.008, a: 1}
|
||||||
|
- {r: 0.906, g: 0.635, b: 0.227, a: 1}
|
||||||
|
- {r: 0.82, g: 0.722, b: 0.318, a: 1}
|
||||||
|
- {r: 0.745, g: 0.435, b: 0.031, a: 1}
|
||||||
|
- {r: 0.765, g: 0.682, b: 0.569, a: 1}
|
||||||
|
- {r: 0.18, g: 0.149, b: 0.075, a: 1}
|
||||||
|
- {r: 0.702, g: 0.451, b: 0.059, a: 1}
|
||||||
|
- name: Passion
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.925, g: 0.682, b: 0.624, a: 1}
|
||||||
|
- {r: 0.188, g: 0.114, b: 0.224, a: 1}
|
||||||
|
- {r: 0.349, g: 0.11, b: 0.231, a: 1}
|
||||||
|
- {r: 0.435, g: 0.267, b: 0.357, a: 1}
|
||||||
|
- name: Sepia
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.353, g: 0.098, b: 0.02, a: 1}
|
||||||
|
- {r: 0.663, g: 0.188, b: 0.114, a: 1}
|
||||||
|
- {r: 0.906, g: 0.643, b: 0.082, a: 1}
|
||||||
|
- {r: 0.996, g: 0.839, b: 0.322, a: 1}
|
||||||
|
- {r: 0.486, g: 0.392, b: 0.02, a: 1}
|
||||||
|
- {r: 0.294, g: 0.235, b: 0.012, a: 1}
|
||||||
|
- name: Floral
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.855, g: 0.518, b: 0.412, a: 1}
|
||||||
|
- {r: 0.827, g: 0.294, b: 0.333, a: 1}
|
||||||
|
- {r: 0.737, g: 0.118, b: 0.208, a: 1}
|
||||||
|
- {r: 0.549, g: 0.149, b: 0.235, a: 1}
|
||||||
|
- {r: 0.949, g: 0.925, b: 0.784, a: 1}
|
||||||
|
- {r: 0.945, g: 0.882, b: 0.69, a: 1}
|
||||||
|
- {r: 0.871, g: 0.812, b: 0.698, a: 1}
|
||||||
|
- {r: 0.4, g: 0.196, b: 0.243, a: 1}
|
||||||
|
- {r: 0.271, g: 0.157, b: 0.227, a: 1}
|
||||||
|
- name: Underwater
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.663, g: 0.416, b: 0.733, a: 1}
|
||||||
|
- {r: 0.2, g: 0.6, b: 0.698, a: 1}
|
||||||
|
- {r: 0.11, g: 0.49, b: 0.698, a: 1}
|
||||||
|
- {r: 0.439, g: 0.627, b: 0.227, a: 1}
|
||||||
|
- {r: 0, g: 0.357, b: 0.604, a: 1}
|
||||||
|
- {r: 0.067, g: 0.271, b: 0.353, a: 1}
|
||||||
|
- name: Breeze
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.706, g: 1, b: 0, a: 1}
|
||||||
|
- {r: 0.651, g: 1, b: 0.404, a: 1}
|
||||||
|
- {r: 0.122, g: 1, b: 0.514, a: 1}
|
||||||
|
- {r: 0.216, g: 0.894, b: 0.961, a: 1}
|
||||||
|
- {r: 0.4, g: 1, b: 0.882, a: 1}
|
||||||
|
- {r: 0.027, g: 0.792, b: 0.8, a: 1}
|
||||||
|
- name: Clovers
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.431, g: 0.549, b: 0.102, a: 1}
|
||||||
|
- {r: 0.671, g: 0.714, b: 0.071, a: 1}
|
||||||
|
- {r: 0.969, g: 0.949, b: 0.831, a: 1}
|
||||||
|
- {r: 0.886, g: 0.902, b: 0.702, a: 1}
|
||||||
|
- {r: 0.753, g: 0.824, b: 0.627, a: 1}
|
||||||
|
- {r: 0.404, g: 0.6, b: 0.4, a: 1}
|
||||||
|
- name: Tropical
|
||||||
|
showAlpha: 0
|
||||||
|
colors:
|
||||||
|
- {r: 0.953, g: 0.647, b: 0.804, a: 1}
|
||||||
|
- {r: 0.965, g: 0.741, b: 0.871, a: 1}
|
||||||
|
- {r: 0.949, g: 0.549, b: 0.643, a: 1}
|
||||||
|
- {r: 0.992, g: 0.659, b: 0.498, a: 1}
|
||||||
|
- {r: 0.976, g: 0.792, b: 0.729, a: 1}
|
||||||
|
- {r: 0.984, g: 0.855, b: 0.725, a: 1}
|
||||||
|
- {r: 0.259, g: 0.882, b: 0.663, a: 1}
|
||||||
|
- {r: 0.349, g: 0.753, b: 0.78, a: 1}
|
||||||
|
- {r: 0.725, g: 0.976, b: 0.91, a: 1}
|
||||||
|
- {r: 0.647, g: 0.745, b: 0.957, a: 1}
|
||||||
|
- {r: 0.725, g: 0.863, b: 0.973, a: 1}
|
||||||
|
- {r: 0.89, g: 0.945, b: 0.996, a: 1}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d6a3216c4fd1c1a499b50f354c57f048
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
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: 188390376, guid: a4865f1ab4504ed8a368670db22f409c, type: 3}
|
||||||
|
m_Name: ImportSettingsConfig
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
automateBeforeBuild: 1
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f6e0f897646bbb54b8306b7d6c6d955d
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -6587,6 +6587,7 @@ GameObject:
|
|||||||
- component: {fileID: 1992890478}
|
- component: {fileID: 1992890478}
|
||||||
- component: {fileID: 1992890477}
|
- component: {fileID: 1992890477}
|
||||||
- component: {fileID: 1992890479}
|
- component: {fileID: 1992890479}
|
||||||
|
- component: {fileID: 1992890480}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Player
|
m_Name: Player
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -6774,8 +6775,8 @@ MonoBehaviour:
|
|||||||
_version: 3.31
|
_version: 3.31
|
||||||
_category:
|
_category:
|
||||||
_comments:
|
_comments:
|
||||||
_translation: {x: -51, y: 507}
|
_translation: {x: -229, y: 359}
|
||||||
_zoomFactor: 0.97967756
|
_zoomFactor: 1
|
||||||
_firstActivation: 0
|
_firstActivation: 0
|
||||||
_enableAction: 0
|
_enableAction: 0
|
||||||
_disableAction: 0
|
_disableAction: 0
|
||||||
@@ -6809,6 +6810,72 @@ MonoBehaviour:
|
|||||||
- {fileID: 1379573502}
|
- {fileID: 1379573502}
|
||||||
- {fileID: 263093399}
|
- {fileID: 263093399}
|
||||||
lockOnDocument: {fileID: 1223043171}
|
lockOnDocument: {fileID: 1223043171}
|
||||||
|
--- !u!114 &1992890480
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1992890470}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 7a8c0593fef54844383c2f154cf8806c, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
observers:
|
||||||
|
- label: gamedev
|
||||||
|
drawLabel: 0
|
||||||
|
children:
|
||||||
|
- rid: 1192470264890523893
|
||||||
|
- rid: 1192470264890523894
|
||||||
|
labelLocationOffset: {x: 0, y: 0, z: 0}
|
||||||
|
labelRotationOffset: {x: 0, y: 0, z: 0}
|
||||||
|
active: 0
|
||||||
|
length: 0
|
||||||
|
width: 0
|
||||||
|
start: {x: 0, y: 0, z: 0}
|
||||||
|
direction: {x: 0, y: 0, z: 0}
|
||||||
|
useLayerMask: 0
|
||||||
|
ignoreMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
references:
|
||||||
|
version: 2
|
||||||
|
RefIds:
|
||||||
|
- rid: 1192470264890523893
|
||||||
|
type: {class: EnvironmentObserver, ns: , asm: Core}
|
||||||
|
data:
|
||||||
|
label: gamedev
|
||||||
|
drawLabel: 0
|
||||||
|
children: []
|
||||||
|
labelLocationOffset: {x: 0, y: 0, z: 0}
|
||||||
|
labelRotationOffset: {x: 0, y: 0, z: 0}
|
||||||
|
active: 0
|
||||||
|
length: 0
|
||||||
|
width: 0
|
||||||
|
start: {x: 0, y: 0, z: 0}
|
||||||
|
direction: {x: 0, y: 0, z: 0}
|
||||||
|
useLayerMask: 0
|
||||||
|
ignoreMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
- rid: 1192470264890523894
|
||||||
|
type: {class: EnvironmentObserver, ns: , asm: Core}
|
||||||
|
data:
|
||||||
|
label: gamedev
|
||||||
|
drawLabel: 0
|
||||||
|
children: []
|
||||||
|
labelLocationOffset: {x: 0, y: 0, z: 0}
|
||||||
|
labelRotationOffset: {x: 0, y: 0, z: 0}
|
||||||
|
active: 0
|
||||||
|
length: 0
|
||||||
|
width: 0
|
||||||
|
start: {x: 0, y: 0, z: 0}
|
||||||
|
direction: {x: 0, y: 0, z: 0}
|
||||||
|
useLayerMask: 0
|
||||||
|
ignoreMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
--- !u!1 &2024357130
|
--- !u!1 &2024357130
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
146
Assets/Scripts/Player/PlayerEnvironmentManager.cs
Normal file
146
Assets/Scripts/Player/PlayerEnvironmentManager.cs
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Drawing;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using Sirenix.Serialization;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class EnvironmentObserver{
|
||||||
|
// TODO: Clean this ugly shit up.
|
||||||
|
public string label;
|
||||||
|
public bool drawLabel;
|
||||||
|
|
||||||
|
enum LabelDrawingLocation{
|
||||||
|
PlayerOffset,
|
||||||
|
HitLocation,
|
||||||
|
IntersectingLength,
|
||||||
|
}
|
||||||
|
|
||||||
|
[SerializeReference]
|
||||||
|
public List<EnvironmentObserver> children;
|
||||||
|
|
||||||
|
public Vector3 labelLocationOffset;
|
||||||
|
public Vector3 labelRotationOffset;
|
||||||
|
|
||||||
|
[ShowInInspector]
|
||||||
|
LabelDrawingLocation labelLocation;
|
||||||
|
|
||||||
|
public bool active;
|
||||||
|
public float length;
|
||||||
|
public float width;
|
||||||
|
|
||||||
|
public Vector3 start;
|
||||||
|
public Vector3 direction;
|
||||||
|
|
||||||
|
public bool useLayerMask;
|
||||||
|
public LayerMask ignoreMask;
|
||||||
|
|
||||||
|
public RaycastHit hit;
|
||||||
|
|
||||||
|
public bool Evaluate(GameObject player){
|
||||||
|
if (active) {
|
||||||
|
ignoreMask -= player.layer;
|
||||||
|
|
||||||
|
Vector3 relativeStart = player.transform.position + start;
|
||||||
|
// NOTE: I had a ref for a RaycastHit here that would correspond to hit but idk if it's needed.
|
||||||
|
Physics.Raycast(relativeStart, player.transform.rotation * direction, out hit, length, ignoreMask);
|
||||||
|
|
||||||
|
if (hit.transform != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hit = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawObserverGizmo(GameObject player){
|
||||||
|
Vector3 relativeStart = player.transform.position + start;
|
||||||
|
|
||||||
|
using (Draw.ingame.WithColor(Evaluate(player) ? Color.green : Color.red)) {
|
||||||
|
Vector3 labelStartPos = Vector3.zero;
|
||||||
|
switch (labelLocation) {
|
||||||
|
case LabelDrawingLocation.PlayerOffset:
|
||||||
|
labelStartPos = player.transform.position + labelLocationOffset;
|
||||||
|
break;
|
||||||
|
case LabelDrawingLocation.IntersectingLength:
|
||||||
|
labelStartPos = (relativeStart + (player.transform.rotation * direction * length) / 2f ) + labelLocationOffset;
|
||||||
|
break;
|
||||||
|
case LabelDrawingLocation.HitLocation:{
|
||||||
|
if (hit.transform != null) {
|
||||||
|
labelStartPos = hit.point + labelLocationOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.ingame.Line(relativeStart, relativeStart + (player.transform.rotation * direction) * length);
|
||||||
|
Draw.ingame.Label3D(
|
||||||
|
labelStartPos,
|
||||||
|
player.transform.rotation * Quaternion.Euler(labelRotationOffset),
|
||||||
|
hit.collider == null ? "" : hit.collider.name,
|
||||||
|
.5f,
|
||||||
|
LabelAlignment.Center,
|
||||||
|
Color.black
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PlayerEnvironmentManager : MonoBehaviour{
|
||||||
|
[OdinSerialize]
|
||||||
|
public List<EnvironmentObserver> observers;
|
||||||
|
|
||||||
|
void Start(){
|
||||||
|
CheckDuplicateLabels(observers);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Not working.
|
||||||
|
void CheckDuplicateLabels(List<EnvironmentObserver> sourceList){
|
||||||
|
foreach (EnvironmentObserver sourceObserver in observers) {
|
||||||
|
foreach (EnvironmentObserver observer in sourceList) {
|
||||||
|
if (sourceObserver == observer) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceObserver.label == observer.label) {
|
||||||
|
Debug.LogError($"Duplicate label found in observer: {observer.label} is in use multiple times");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (observer.children != null && observer.children.Count > 0) {
|
||||||
|
CheckDuplicateLabels(observer.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EvaluateFromString(string searchLabel, List<EnvironmentObserver> observerList = null){
|
||||||
|
List<EnvironmentObserver> listToUse = observers;
|
||||||
|
|
||||||
|
if (observerList != null) {
|
||||||
|
listToUse = observerList;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (EnvironmentObserver observer in listToUse) {
|
||||||
|
if (observer.label == searchLabel) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (observer.children != null && observer.children.Count > 0) {
|
||||||
|
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||||
|
EvaluateFromString(searchLabel, childObserver.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LateUpdate(){
|
||||||
|
foreach (EnvironmentObserver observer in observers) {
|
||||||
|
observer.DrawObserverGizmo(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Scripts/Player/PlayerEnvironmentManager.cs.meta
Normal file
2
Assets/Scripts/Player/PlayerEnvironmentManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7a8c0593fef54844383c2f154cf8806c
|
||||||
@@ -15,28 +15,28 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
thisPlayer = GetComponent<Player>();
|
thisPlayer = GetComponent<Player>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update(){
|
// void Update(){
|
||||||
// Create Ray Colors
|
// // Create Ray Colors
|
||||||
Color forwardRayStatus = Color.red;
|
// Color forwardRayStatus = Color.red;
|
||||||
Color leftRayStatus = Color.red;
|
// Color leftRayStatus = Color.red;
|
||||||
Color rightRayStatus = Color.red;
|
// Color rightRayStatus = Color.red;
|
||||||
|
//
|
||||||
if (forwardRay.collider&& forwardRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ forwardRayStatus = Color.green;}
|
// if (forwardRay.collider&& forwardRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ forwardRayStatus = Color.green;}
|
||||||
if (leftRay.collider&& leftRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ leftRayStatus = Color.green;}
|
// if (leftRay.collider&& leftRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ leftRayStatus = Color.green;}
|
||||||
if (rightRay.collider&& rightRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ rightRayStatus = Color.green;}
|
// if (rightRay.collider&& rightRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ rightRayStatus = Color.green;}
|
||||||
|
//
|
||||||
using (Draw.WithColor(forwardRayStatus)) {
|
// using (Draw.WithColor(forwardRayStatus)) {
|
||||||
Draw.Line(transform.position + transform.up, transform.position + transform.forward * 2.5f + transform.up);
|
// Draw.Line(transform.position + transform.up, transform.position + transform.forward * 2.5f + transform.up);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
using (Draw.WithColor(leftRayStatus)) {
|
// using (Draw.WithColor(leftRayStatus)) {
|
||||||
Draw.Line(transform.position + transform.up, transform.position + -transform.right * 2f + transform.up);
|
// Draw.Line(transform.position + transform.up, transform.position + -transform.right * 2f + transform.up);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
using (Draw.WithColor(rightRayStatus)) {
|
// using (Draw.WithColor(rightRayStatus)) {
|
||||||
Draw.Line(transform.position + transform.up, transform.position + transform.right * 2f + transform.up);
|
// Draw.Line(transform.position + transform.up, transform.position + transform.right * 2f + transform.up);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void FixedUpdate(){
|
void FixedUpdate(){
|
||||||
LayerMask environmentLayer = LayerMask.NameToLayer("Environment");
|
LayerMask environmentLayer = LayerMask.NameToLayer("Environment");
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||||
"GUID:de4e6084e6d474788bb8c799d6b461ec",
|
"GUID:de4e6084e6d474788bb8c799d6b461ec",
|
||||||
"GUID:d8b63aba1907145bea998dd612889d6b",
|
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||||
"GUID:4307f53044263cf4b835bd812fc161a4"
|
"GUID:4307f53044263cf4b835bd812fc161a4",
|
||||||
|
"GUID:e0cd26848372d4e5c891c569017e11f1"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ MonoBehaviour:
|
|||||||
lineOpacity: 1
|
lineOpacity: 1
|
||||||
solidOpacity: 0.55
|
solidOpacity: 0.55
|
||||||
textOpacity: 1
|
textOpacity: 1
|
||||||
lineOpacityBehindObjects: 0.12
|
lineOpacityBehindObjects: 0.3186
|
||||||
solidOpacityBehindObjects: 0.45
|
solidOpacityBehindObjects: 0.1286
|
||||||
textOpacityBehindObjects: 0.9
|
textOpacityBehindObjects: 0.0881
|
||||||
curveResolution: 1
|
curveResolution: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user