Compare commits
10 Commits
main
...
39313c96d0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39313c96d0 | ||
|
|
4a1dbb9728 | ||
|
|
7fbe05e39b | ||
|
|
92c6ac0016 | ||
|
|
706e53c5f7 | ||
|
|
1c27be3e2f | ||
|
|
7ee82db2cb | ||
|
|
e95748e0e2 | ||
|
|
355f6207a5 | ||
|
|
43de6b0d3b |
@@ -21,7 +21,7 @@ MonoBehaviour:
|
|||||||
_version: 3.31
|
_version: 3.31
|
||||||
_category:
|
_category:
|
||||||
_comments:
|
_comments:
|
||||||
_translation: {x: 1, y: -175}
|
_translation: {x: 21, y: -46}
|
||||||
_zoomFactor: 0.9967056
|
_zoomFactor: 0.9967056
|
||||||
_haltSerialization: 0
|
_haltSerialization: 0
|
||||||
_externalSerializationFile: {fileID: 0}
|
_externalSerializationFile: {fileID: 0}
|
||||||
|
|||||||
@@ -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:
|
||||||
File diff suppressed because one or more lines are too long
@@ -10,19 +10,23 @@ using Reset.Player.Movement;
|
|||||||
namespace NodeCanvas.Tasks.Actions {
|
namespace NodeCanvas.Tasks.Actions {
|
||||||
[Category("Reset/Movement")]
|
[Category("Reset/Movement")]
|
||||||
public class AddJump : ActionTask<CharacterController> {
|
public class AddJump : ActionTask<CharacterController> {
|
||||||
public BBParameter<float> jumpStrength;
|
|
||||||
public BBParameter<Vector3> airMoveDirection;
|
public BBParameter<Vector3> airMoveDirection;
|
||||||
|
public BBParameter<float> jumpPower;
|
||||||
|
|
||||||
public BBParameter<PlayerFacingDirection> playerFacingDirection;
|
[Space(5)]
|
||||||
|
public BBParameter<float> jumpStrength;
|
||||||
|
|
||||||
[Range(0f, 1f)]
|
[SliderField(0, 1)]
|
||||||
public BBParameter<float> standStillJumpStrength;
|
public BBParameter<float> standStillJumpStrength;
|
||||||
|
|
||||||
public BBParameter<float> jumpPower;
|
|
||||||
|
|
||||||
[Tooltip("Determines how much current movement vectors into jump direction")]
|
[Tooltip("Determines how much current movement vectors into jump direction")]
|
||||||
|
[SliderField(0, 1)]
|
||||||
public BBParameter<float> currentVelocityInheritence;
|
public BBParameter<float> currentVelocityInheritence;
|
||||||
public BBParameter<Vector3> directionalForce;
|
public BBParameter<Vector3> directionalForce;
|
||||||
|
|
||||||
|
[SliderField(0, 1)]
|
||||||
public BBParameter<float> directionalForceStrength;
|
public BBParameter<float> directionalForceStrength;
|
||||||
|
|
||||||
protected override string info {
|
protected override string info {
|
||||||
@@ -72,9 +76,12 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
// Check threshold of current XZ velocity- if it's too close to zero, use the jumpStrength for jumping velocity. If it's not, use the current velocity
|
// Check threshold of current XZ velocity- if it's too close to zero, use the jumpStrength for jumping velocity. If it's not, use the current velocity
|
||||||
float velocityThreshold = 4f;
|
float velocityThreshold = 4f;
|
||||||
float magnitudeZeroDifference = Mathf.Clamp(currentVelocityVector3.magnitude - velocityThreshold, 0f, Mathf.Infinity) / velocityThreshold; // Divided by maximum to return a 0-1 value. Clamping not required.
|
float magnitudeZeroDifference = Mathf.Clamp(currentVelocityVector3.magnitude - velocityThreshold, 0f, Mathf.Infinity) / velocityThreshold; // Divided by maximum to return a 0-1 value. Clamping not required.
|
||||||
float outputVelocity = Mathf.Lerp(jumpStrength.value, currentVelocityVector3.magnitude, Math.Clamp(magnitudeZeroDifference, 0f, 1f));
|
float outputHoritontalVelocity = Mathf.Lerp(jumpStrength.value, currentVelocityVector3.magnitude, Math.Clamp(magnitudeZeroDifference, 0f, 1f));
|
||||||
|
|
||||||
outputVelocity = Mathf.Min(outputVelocity, Mathf.Lerp(standStillJumpStrength.value * jumpStrength.value, jumpStrength.value * .4f, magnitudeZeroDifference));
|
outputHoritontalVelocity = Mathf.Min(outputHoritontalVelocity, Mathf.Lerp(standStillJumpStrength.value * jumpStrength.value, jumpStrength.value * .4f, magnitudeZeroDifference));
|
||||||
|
|
||||||
|
// Do the same for directional jump strength
|
||||||
|
outputHoritontalVelocity = Mathf.Lerp(outputHoritontalVelocity, jumpStrength.value, directionalForceStrength.value);
|
||||||
|
|
||||||
// Remap the dot to set -1 (opposing direction) to -.5f, and 1 (same direciton) to 1.2f
|
// Remap the dot to set -1 (opposing direction) to -.5f, and 1 (same direciton) to 1.2f
|
||||||
// This is done to allow some sideways jumping direction change, but none backwards, and all forwards
|
// This is done to allow some sideways jumping direction change, but none backwards, and all forwards
|
||||||
@@ -94,7 +101,7 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
outputDirection = Camera.main.transform.rotation.Flatten(0, null, 0) * outputDirection;
|
outputDirection = Camera.main.transform.rotation.Flatten(0, null, 0) * outputDirection;
|
||||||
|
|
||||||
// Set air move direction
|
// Set air move direction
|
||||||
airMoveDirection.value += outputDirection * outputVelocity;
|
airMoveDirection.value += outputDirection * outputHoritontalVelocity;
|
||||||
}
|
}
|
||||||
EndAction(true);
|
EndAction(true);
|
||||||
}
|
}
|
||||||
|
|||||||
121
Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs
Normal file
121
Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using NodeCanvas.Framework;
|
||||||
|
using ParadoxNotion.Design;
|
||||||
|
using ParadoxNotion.Serialization.FullSerializer;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NodeCanvas.Tasks.Actions {
|
||||||
|
|
||||||
|
[Category("Reset")]
|
||||||
|
[Description("Update the agent's position and rotation (scale too, sure whynot) either instantly or over time.")]
|
||||||
|
public class ChangeAgentTransform : ActionTask<CharacterController>{
|
||||||
|
public enum TransformProperty{
|
||||||
|
Position,
|
||||||
|
Rotation,
|
||||||
|
Scale
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string info {
|
||||||
|
get{
|
||||||
|
string basicText = string.Format($"Player {targetProperty.ToString()} to {(targetValue.isPresumedDynamic ? targetValue.name : targetValue.value)}");
|
||||||
|
basicText += relativeToSelf.value ? ", relative to Self" : "";
|
||||||
|
|
||||||
|
return basicText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransformProperty targetProperty;
|
||||||
|
|
||||||
|
[ParadoxNotion.Design.ShowIf("targetProperty", 0), Space(5)]
|
||||||
|
public BBParameter<bool> forcePositionChange;
|
||||||
|
|
||||||
|
public BBParameter<Vector3> targetValue;
|
||||||
|
|
||||||
|
public BBParameter<bool> relativeToSelf;
|
||||||
|
|
||||||
|
[Tooltip("Set this to the current position if you're trying to rotate by 'this much'. Keep it zero for world space values.")]
|
||||||
|
public BBParameter<Vector3> relativeValue;
|
||||||
|
|
||||||
|
public BBParameter<bool> changeInstantly;
|
||||||
|
public BBParameter<float> smoothing;
|
||||||
|
|
||||||
|
private Vector3 currentVel;
|
||||||
|
|
||||||
|
|
||||||
|
//Use for initialization. This is called only once in the lifetime of the task.
|
||||||
|
//Return null if init was successfull. Return an error string otherwise
|
||||||
|
protected override string OnInit() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This is called once each time the task is enabled.
|
||||||
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||||
|
//EndAction can be called from anywhere.
|
||||||
|
protected override void OnExecute() {
|
||||||
|
switch (targetProperty) {
|
||||||
|
case TransformProperty.Position:
|
||||||
|
Vector3 relativeUseValue = relativeValue.value;
|
||||||
|
if (relativeToSelf.value) {
|
||||||
|
relativeUseValue = agent.transform.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changeInstantly.value) {
|
||||||
|
agent.Move(agent.transform.position.DirectionTo(relativeUseValue + targetValue.value));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case TransformProperty.Rotation:
|
||||||
|
// agent.transform = Quaternion.Euler(relativeValue.value + targetValue.value);
|
||||||
|
break;
|
||||||
|
case TransformProperty.Scale:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changeInstantly.value) {
|
||||||
|
EndAction(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called once per frame while the action is active.
|
||||||
|
protected override void OnUpdate() {
|
||||||
|
switch (targetProperty) {
|
||||||
|
case TransformProperty.Position:
|
||||||
|
Vector3 relativeUseValue = relativeValue.value;
|
||||||
|
if (relativeToSelf.value) {
|
||||||
|
relativeUseValue = agent.transform.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!changeInstantly.value) {
|
||||||
|
Vector3 targetPosition = relativeUseValue + targetValue.value;
|
||||||
|
// agent.transform.position = Vector3.SmoothDamp(agent.transform.position, targetPosition,
|
||||||
|
// ref currentVel, smoothing.value * Time.deltaTime);
|
||||||
|
|
||||||
|
agent.Move((agent.transform.position.DirectionTo(targetPosition)).normalized * .5f * Mathf.Lerp(0, 1, Vector3.Distance(agent.transform.position, targetPosition)) * smoothing.value * Time.deltaTime);
|
||||||
|
EndAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case TransformProperty.Rotation:
|
||||||
|
agent.transform.rotation = Quaternion.Euler(relativeValue.value + targetValue.value);
|
||||||
|
break;
|
||||||
|
case TransformProperty.Scale:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called when the task is disabled.
|
||||||
|
protected override void OnStop() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called when the task is paused.
|
||||||
|
protected override void OnPause() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b77e2b9ac9aad644480508d5a86f4006
|
||||||
55
Assets/Scripts/Core/Graph Tasks/CheckEnvironmentObserver.cs
Normal file
55
Assets/Scripts/Core/Graph Tasks/CheckEnvironmentObserver.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using NodeCanvas.Framework;
|
||||||
|
using ParadoxNotion.Design;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NodeCanvas.Tasks.Conditions {
|
||||||
|
[Category("Reset")]
|
||||||
|
public class CheckEnvironmentObserver : ConditionTask<PlayerEnvironmentManager>{
|
||||||
|
|
||||||
|
public BBParameter<string> observerLabel;
|
||||||
|
public BBParameter<RaycastHit> outputHitTo;
|
||||||
|
|
||||||
|
|
||||||
|
//Use for initialization. This is called only once in the lifetime of the task.
|
||||||
|
//Return null if init was successfull. Return an error string otherwise
|
||||||
|
protected override string OnInit(){
|
||||||
|
var observer = agent.FindObserverFromString(observerLabel.value);
|
||||||
|
if (observer == null) {
|
||||||
|
return $"An environment observer couldn't be found under the name {observerLabel.value}. Check your spelling and if it exists??";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called whenever the condition gets enabled.
|
||||||
|
protected override void OnEnable() {
|
||||||
|
agent.FindObserverFromString(observerLabel.value).active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called whenever the condition gets disabled.
|
||||||
|
protected override void OnDisable() {
|
||||||
|
agent.FindObserverFromString(observerLabel.value).active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called once per frame while the condition is active.
|
||||||
|
//Return whether the condition is success or failure.
|
||||||
|
protected override bool OnCheck(){
|
||||||
|
if (agent.EvaluateFromString(observerLabel.value) == true) {
|
||||||
|
if (outputHitTo.isDefined) {
|
||||||
|
EnvironmentObserver hitObserver = agent.FindObserverFromString(observerLabel.value, agent.observers);
|
||||||
|
|
||||||
|
if (hitObserver.hit.Equals(default(RaycastHit))) {
|
||||||
|
Debug.LogError("You just tried to pull a RaycastHit for later use from an environment observer, but no RaycastHit is available. Don't forget that CastType.Box and CastType.Sphere CANNOT spit one out!");
|
||||||
|
} else {
|
||||||
|
outputHitTo.value = hitObserver.hit;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 95ad4bd047d9654478597c68a81b01a0
|
||||||
55
Assets/Scripts/Core/Graph Tasks/DecomposeRaycastHit.cs
Normal file
55
Assets/Scripts/Core/Graph Tasks/DecomposeRaycastHit.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using NodeCanvas.Framework;
|
||||||
|
using ParadoxNotion.Design;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
namespace NodeCanvas.Tasks.Actions {
|
||||||
|
|
||||||
|
[Category("Reset")]
|
||||||
|
[Description("Breaks down an incoming RaycastHit into it's constituent parts for later use.")]
|
||||||
|
public class DecomposeRaycastHit : ActionTask{
|
||||||
|
public BBParameter<RaycastHit> raycastHit;
|
||||||
|
|
||||||
|
public BBParameter<Transform> transform;
|
||||||
|
public BBParameter<Collider> collider;
|
||||||
|
public BBParameter<GameObject> gameObject;
|
||||||
|
public BBParameter<float> distance;
|
||||||
|
public BBParameter<Vector3> normal;
|
||||||
|
public BBParameter<Vector3> point;
|
||||||
|
|
||||||
|
//Use for initialization. This is called only once in the lifetime of the task.
|
||||||
|
//Return null if init was successfull. Return an error string otherwise
|
||||||
|
protected override string OnInit() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This is called once each time the task is enabled.
|
||||||
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||||
|
//EndAction can be called from anywhere.
|
||||||
|
protected override void OnExecute(){
|
||||||
|
if (transform.isDefined){ transform.value = raycastHit.value.transform; }
|
||||||
|
if (collider.isDefined){ collider.value = raycastHit.value.collider; }
|
||||||
|
if (gameObject.isDefined){ gameObject.value = raycastHit.value.transform.gameObject; }
|
||||||
|
if (distance.isDefined){ distance.value = raycastHit.value.distance; }
|
||||||
|
if (normal.isDefined){ normal.value = raycastHit.value.normal; }
|
||||||
|
if (point.isDefined){ point.value = raycastHit.value.point; }
|
||||||
|
|
||||||
|
EndAction(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called once per frame while the action is active.
|
||||||
|
protected override void OnUpdate() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called when the task is disabled.
|
||||||
|
protected override void OnStop() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Called when the task is paused.
|
||||||
|
protected override void OnPause() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 79f7cbb75d876f84b8edfae676ba324c
|
||||||
@@ -12,7 +12,8 @@ namespace Reset.Player.Movement{
|
|||||||
public enum PlayerFacingDirection{
|
public enum PlayerFacingDirection{
|
||||||
Target = 0,
|
Target = 0,
|
||||||
Movement,
|
Movement,
|
||||||
MatchCamera
|
MatchCamera,
|
||||||
|
Static
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +100,9 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
// Needed to keep the character from inheriting the camera's height-rotation
|
// Needed to keep the character from inheriting the camera's height-rotation
|
||||||
targetRotation = Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0, null, 0));
|
targetRotation = Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0, null, 0));
|
||||||
break;
|
break;
|
||||||
|
case PlayerFacingDirection.Static:
|
||||||
|
targetRotation = agent.transform.rotation;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct move direction
|
// Construct move direction
|
||||||
|
|||||||
@@ -13,4 +13,7 @@ public static class MathExtensions{
|
|||||||
return (to - origin).normalized;
|
return (to - origin).normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Color Alpha(this Color input, float newAlpha){
|
||||||
|
return new Color(input.r, input.g, input.b, newAlpha);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
349
Assets/Scripts/Player/PlayerEnvironmentManager.cs
Normal file
349
Assets/Scripts/Player/PlayerEnvironmentManager.cs
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Drawing;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using Sirenix.Serialization;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class EnvironmentObserver{
|
||||||
|
enum LabelDrawingLocation{
|
||||||
|
PlayerOffset,
|
||||||
|
HitLocation,
|
||||||
|
IntersectingLength,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CastType{
|
||||||
|
Ray,
|
||||||
|
BoxOverlap,
|
||||||
|
SphereOverlap,
|
||||||
|
BoxCast,
|
||||||
|
SphereCast
|
||||||
|
}
|
||||||
|
|
||||||
|
[PropertySpace(0, 5), LabelWidth(60)]
|
||||||
|
public string label;
|
||||||
|
[PropertySpace(0, 10), LabelWidth(60)]
|
||||||
|
public CastType castType;
|
||||||
|
|
||||||
|
[Button(ButtonSizes.Large), GUIColor("@GetObserverStatusColorStatic(active, hit)"), PropertyOrder(-1), PropertySpace(5, 5)]
|
||||||
|
public void Active(){
|
||||||
|
active = !active;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public bool active;
|
||||||
|
|
||||||
|
// Parameters for Cast cast types
|
||||||
|
[FoldoutGroup("Settings")] public float length;
|
||||||
|
[FoldoutGroup("Settings")] public Vector3 direction;
|
||||||
|
[FoldoutGroup("Settings")] public Vector3 offset;
|
||||||
|
[PropertySpace(0, 5), FoldoutGroup("Settings")] public LayerMask ignoreLayers = ~0;
|
||||||
|
|
||||||
|
|
||||||
|
[ShowIfGroup("Settings/CastsOnly", VisibleIf = "@castType == CastType.SphereCast || castType == CastType.SphereOverlap")]
|
||||||
|
[FoldoutGroup("Settings")] public float width;
|
||||||
|
|
||||||
|
// Parameters for Overlap cast types
|
||||||
|
[ShowIfGroup("Settings/3DOnly", VisibleIf = "@castType == CastType.BoxCast && castType != CastType.BoxOverlap")] [FoldoutGroup("Settings")]
|
||||||
|
public Vector3 size;
|
||||||
|
|
||||||
|
[ShowIfGroup("Settings/3DOnly")]
|
||||||
|
public Vector3 rotation;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public RaycastHit hit;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public Collider[] overlapHits;
|
||||||
|
|
||||||
|
[FoldoutGroup("Text")]
|
||||||
|
[BoxGroup("Text/Label")] public bool drawLabel;
|
||||||
|
[ShowInInspector, SerializeField] [BoxGroup("Text/Label")] LabelDrawingLocation labelTextLocation;
|
||||||
|
[BoxGroup("Text/Label")] public float labelSize;
|
||||||
|
[BoxGroup("Text/Label")] public Vector3 labelLocationOffset;
|
||||||
|
[BoxGroup("Text/Label")] public Vector3 labelRotationOffset;
|
||||||
|
|
||||||
|
[BoxGroup("Text/Hit")] public bool drawHitName;
|
||||||
|
[ShowInInspector, SerializeField] [BoxGroup("Text/Hit")] LabelDrawingLocation hitTextLocation;
|
||||||
|
[BoxGroup("Text/Hit")] public float hitTextSize;
|
||||||
|
[BoxGroup("Text/Hit")] public Vector3 hitLocationOffset;
|
||||||
|
[BoxGroup("Text/Hit")] public Vector3 hitRotationOffset;
|
||||||
|
|
||||||
|
[SerializeReference, PropertySpace(5, 5)]
|
||||||
|
public List<EnvironmentObserver> children;
|
||||||
|
|
||||||
|
// NOTE: I had a ref for a RaycastHit here that would correspond to hit but idk if it's needed.
|
||||||
|
public bool Evaluate(GameObject player){
|
||||||
|
if (active) {
|
||||||
|
// Remove player's layer from LayerMask.
|
||||||
|
ignoreLayers -= player.layer;
|
||||||
|
|
||||||
|
// Set some of the variables used later during casting
|
||||||
|
Vector3 relativeStart = player.transform.position + offset;
|
||||||
|
Vector3 relativeStartWithRotation = player.transform.position + player.transform.rotation * offset ;
|
||||||
|
|
||||||
|
switch (castType) {
|
||||||
|
case CastType.Ray:
|
||||||
|
Physics.Raycast(relativeStart, player.transform.rotation * direction, out hit, length, ignoreLayers);
|
||||||
|
break;
|
||||||
|
case CastType.BoxOverlap:
|
||||||
|
overlapHits = Physics.OverlapBox(relativeStartWithRotation, size / 2f,
|
||||||
|
player.transform.rotation * Quaternion.Euler(rotation), ignoreLayers);
|
||||||
|
|
||||||
|
if (overlapHits.Length > 0) {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
break;
|
||||||
|
case CastType.SphereOverlap:
|
||||||
|
break;
|
||||||
|
case CastType.BoxCast:
|
||||||
|
// TODO: Make this not an if statement. Check that it works with NodeCanvas first
|
||||||
|
if (Physics.BoxCast(relativeStartWithRotation, size / 2f,
|
||||||
|
player.transform.rotation * Quaternion.Euler(rotation) * direction,
|
||||||
|
out hit, player.transform.rotation * Quaternion.Euler(rotation), length,
|
||||||
|
ignoreLayers)
|
||||||
|
) {
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case CastType.SphereCast:
|
||||||
|
// TODO: Make this not an if statement. Check that it works with NodeCanvas first
|
||||||
|
if (Physics.SphereCast(relativeStartWithRotation, width / 2f,
|
||||||
|
player.transform.rotation * Quaternion.Euler(rotation) * direction,
|
||||||
|
out hit, length,
|
||||||
|
ignoreLayers)
|
||||||
|
) {
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hit.transform != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawObserverGizmo(GameObject player){
|
||||||
|
Vector3 relativeStart = player.transform.position + offset;
|
||||||
|
Vector3 relativeStartWithRotation = player.transform.position + player.transform.rotation * (offset);
|
||||||
|
|
||||||
|
// Setup the variables for boxcast, spherecast, etc
|
||||||
|
// Create an offset start point for the center of the wirebox, since gizmos are drawn with their pivot in the center.
|
||||||
|
Vector3 offsetWithRotationAndLength = (Quaternion.LookRotation(direction) * Quaternion.Euler(rotation)) * (Vector3.forward * (length / 2));
|
||||||
|
Vector3 offsetFromCenter = relativeStartWithRotation + player.transform.rotation * offsetWithRotationAndLength;
|
||||||
|
|
||||||
|
// Also create a rotation for use with the gizmos. Mainly just to shorten the lines
|
||||||
|
Quaternion gizmosRotation = player.transform.rotation * Quaternion.LookRotation(direction) * Quaternion.Euler(rotation);
|
||||||
|
Vector3 firstBoxOffset = gizmosRotation * (Vector3.forward * size.z);
|
||||||
|
|
||||||
|
Color gizmoColor = Evaluate(player) ? Color.green : Color.red;
|
||||||
|
gizmoColor = active ? gizmoColor : Color.gray;
|
||||||
|
|
||||||
|
using (Draw.ingame.WithColor(gizmoColor)){
|
||||||
|
switch (castType) {
|
||||||
|
case CastType.Ray:
|
||||||
|
Draw.ingame.Line(relativeStart, relativeStart + (player.transform.rotation * direction.normalized) * length);
|
||||||
|
break;
|
||||||
|
case CastType.BoxOverlap:
|
||||||
|
Draw.ingame.WireBox(relativeStartWithRotation, player.transform.rotation * Quaternion.Euler(rotation), size);
|
||||||
|
break;
|
||||||
|
case CastType.SphereCast:
|
||||||
|
Draw.ingame.SolidCircle(relativeStartWithRotation, relativeStartWithRotation - Camera.main.transform.position, width * 1, gizmoColor.Alpha(.5f));
|
||||||
|
Draw.ingame.WireCapsule(relativeStartWithRotation, relativeStartWithRotation + gizmosRotation * (Vector3.forward * (length - width / 2)), width);
|
||||||
|
break;
|
||||||
|
case CastType.BoxCast:
|
||||||
|
// Draw the gizmos for the boxcast
|
||||||
|
Draw.ingame.WireBox(offsetFromCenter, gizmosRotation, new float3(size.x, size.y, length));
|
||||||
|
Draw.ingame.SolidBox(relativeStartWithRotation, gizmosRotation, size, gizmoColor.Alpha(.1f));
|
||||||
|
|
||||||
|
Draw.ingame.WireBox(relativeStartWithRotation, gizmosRotation, size);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.ingame.SolidCircle(relativeStartWithRotation, relativeStartWithRotation - Camera.main.transform.position, .4f);
|
||||||
|
Draw.ingame.SolidCircle(hit.point, hit.point - Camera.main.transform.position, .4f);
|
||||||
|
|
||||||
|
// Set up variables for label (not hit name)
|
||||||
|
Vector3 labelStartPos = Vector3.zero;
|
||||||
|
switch (labelTextLocation) {
|
||||||
|
case LabelDrawingLocation.PlayerOffset:
|
||||||
|
labelStartPos = player.transform.position;
|
||||||
|
break;
|
||||||
|
case LabelDrawingLocation.IntersectingLength:
|
||||||
|
labelStartPos = offsetFromCenter;
|
||||||
|
break;
|
||||||
|
case LabelDrawingLocation.HitLocation:{
|
||||||
|
if (hit.transform != null) {
|
||||||
|
labelStartPos = hit.point;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw label
|
||||||
|
if (drawLabel) {
|
||||||
|
Draw.ingame.Label3D(
|
||||||
|
labelStartPos + labelLocationOffset,
|
||||||
|
gizmosRotation * Quaternion.Euler(labelRotationOffset),
|
||||||
|
label,
|
||||||
|
labelSize,
|
||||||
|
LabelAlignment.MiddleLeft,
|
||||||
|
gizmoColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up variables for hit name
|
||||||
|
// Since the label is already drawn just use the previous startPos
|
||||||
|
switch (labelTextLocation) {
|
||||||
|
case LabelDrawingLocation.PlayerOffset:
|
||||||
|
labelStartPos = player.transform.position;
|
||||||
|
break;
|
||||||
|
case LabelDrawingLocation.IntersectingLength:
|
||||||
|
labelStartPos = offsetFromCenter;
|
||||||
|
break;
|
||||||
|
case LabelDrawingLocation.HitLocation:{
|
||||||
|
if (hit.transform != null) {
|
||||||
|
labelStartPos = hit.point;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw hitname
|
||||||
|
if (drawLabel) {
|
||||||
|
Draw.ingame.Label3D(
|
||||||
|
labelStartPos + labelLocationOffset,
|
||||||
|
gizmosRotation * Quaternion.Euler(labelRotationOffset),
|
||||||
|
label,
|
||||||
|
hitTextSize,
|
||||||
|
LabelAlignment.MiddleLeft,
|
||||||
|
gizmoColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sirenix.Utilities.Editor.GUIHelper.RequestRepaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static Color GetObserverStatusColorStatic(bool active, RaycastHit hit){
|
||||||
|
if (active) {
|
||||||
|
if (hit.Equals(default(RaycastHit))) {
|
||||||
|
return Color.green;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Color.red;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Color.gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 observer.Evaluate(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (observer.children != null && observer.children.Count > 0) {
|
||||||
|
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||||
|
EvaluateFromString(searchLabel, childObserver.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnvironmentObserver FindObserverFromString(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 observer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (observer.children != null && observer.children.Count > 0) {
|
||||||
|
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||||
|
FindObserverFromString(searchLabel, childObserver.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update(){
|
||||||
|
Debug.Log(EvaluateFromString("gamedev"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LateUpdate(){
|
||||||
|
// Draw Gizmos
|
||||||
|
foreach (EnvironmentObserver observer in observers) {
|
||||||
|
observer.DrawObserverGizmo(gameObject);
|
||||||
|
|
||||||
|
if (observer.children != null && observer.children.Count > 0) {
|
||||||
|
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||||
|
childObserver.DrawObserverGizmo(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear hit
|
||||||
|
foreach (EnvironmentObserver observer in observers) {
|
||||||
|
observer.hit = default;
|
||||||
|
|
||||||
|
if (observer.children != null && observer.children.Count > 0) {
|
||||||
|
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||||
|
childObserver.hit = default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
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
|
||||||
|
|||||||
BIN
Documents/Graphics/UI/Icons.afdesign
Normal file
BIN
Documents/Graphics/UI/Icons.afdesign
Normal file
Binary file not shown.
Reference in New Issue
Block a user