This commit is contained in:
NIMFER 2021-08-28 14:01:32 +02:00
commit 0a2e2a273c
4 changed files with 135 additions and 19 deletions

View file

@ -1525,6 +1525,52 @@ Mesh:
offset: 0 offset: 0
size: 0 size: 0
path: path:
--- !u!1 &1449662312
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1449662314}
- component: {fileID: 1449662313}
m_Layer: 0
m_Name: WkurwHandler
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1449662313
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1449662312}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 38918a99291c1d74db80e6685fdc39c9, type: 3}
m_Name:
m_EditorClassIdentifier:
health: 100
anger: 0
fear: 0
--- !u!4 &1449662314
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1449662312}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -10.344179, y: 7.2330303, z: -0.9402442}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1472737031 --- !u!1 &1472737031
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1537,7 +1583,7 @@ GameObject:
- component: {fileID: 1472737035} - component: {fileID: 1472737035}
- component: {fileID: 1472737034} - component: {fileID: 1472737034}
- component: {fileID: 1472737033} - component: {fileID: 1472737033}
m_Layer: 3 m_Layer: 6
m_Name: Cube m_Name: Cube
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -1820,7 +1866,7 @@ GameObject:
- component: {fileID: 1729498776} - component: {fileID: 1729498776}
- component: {fileID: 1729498775} - component: {fileID: 1729498775}
- component: {fileID: 1729498773} - component: {fileID: 1729498773}
m_Layer: 3 m_Layer: 6
m_Name: Robber m_Name: Robber
m_TagString: Robber m_TagString: Robber
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -2253,14 +2299,20 @@ MonoBehaviour:
trapActivationReachRangeDebugColor: {r: 1, g: 0.28652775, b: 0, a: 0.3764706} trapActivationReachRangeDebugColor: {r: 1, g: 0.28652775, b: 0, a: 0.3764706}
showInteractionReach: 1 showInteractionReach: 1
trapInteractionReachRangeDebugColor: {r: 0, g: 0.21038437, b: 1, a: 1} trapInteractionReachRangeDebugColor: {r: 0, g: 0.21038437, b: 1, a: 1}
isSet: 1 isSet: 0
isActivated: 0 wasUsed: 0
playerInRange: 0 playerInRange: 0
robberInRange: 0 robberInRange: 0
inputReferences: {fileID: 1945878217} inputReferences: {fileID: 1945878217}
unsetMaterial: {fileID: 2100000, guid: 79f64ed6f5d6d374d91c3a0af4070258, type: 2} unsetMaterial: {fileID: 2100000, guid: 79f64ed6f5d6d374d91c3a0af4070258, type: 2}
setMaterial: {fileID: 2100000, guid: 5a26de236ce89e94b963be8fa2b7ade6, type: 2} setMaterial: {fileID: 2100000, guid: 5a26de236ce89e94b963be8fa2b7ade6, type: 2}
trapType: Pinns player:
serializedVersion: 2
m_Bits: 8
robber:
serializedVersion: 2
m_Bits: 64
trapType: Pins
linkAllOffsets: 1 linkAllOffsets: 1
masterOffset: {x: 0.5, y: 0.5, z: -0.5} masterOffset: {x: 0.5, y: 0.5, z: -0.5}
trapInteractionRadiusOffset: {x: 0.5, y: 0.5, z: -0.5} trapInteractionRadiusOffset: {x: 0.5, y: 0.5, z: -0.5}
@ -2271,8 +2323,6 @@ MonoBehaviour:
trapRange: 5 trapRange: 5
hasActivationDelay: 0 hasActivationDelay: 0
trapActivationDelay: 0 trapActivationDelay: 0
isRechargable: 0
rechargeTime: 0
requieresPlayer: 0 requieresPlayer: 0
--- !u!114 &1945878217 --- !u!114 &1945878217
MonoBehaviour: MonoBehaviour:

View file

@ -19,7 +19,7 @@ public class Trap : MonoBehaviour
public Color trapInteractionReachRangeDebugColor; public Color trapInteractionReachRangeDebugColor;
public bool isSet; public bool isSet;
public bool isActivated; public bool wasUsed;
public bool playerInRange; public bool playerInRange;
public bool robberInRange; public bool robberInRange;
public PlayerControls dobberControls; public PlayerControls dobberControls;
@ -35,7 +35,7 @@ public class Trap : MonoBehaviour
[Dropdown("trapTypes")] [Dropdown("trapTypes")]
public string trapType; public string trapType;
private string[] trapTypes = new string[] { "Pinns", "Rope", "Ladder", "Bear Trap", "Bannana Peal" }; private string[] trapTypes = new string[] { "Pins", "Rope", "Ladder", "Bear Trap", "Bannana Peel" };
public bool linkAllOffsets; public bool linkAllOffsets;
@ -57,10 +57,6 @@ public class Trap : MonoBehaviour
[ShowIf("hasActivationDelay")] [ShowIf("hasActivationDelay")]
public float trapActivationDelay; public float trapActivationDelay;
public bool isRechargable;
[ShowIf("isRechargable")]
public float rechargeTime;
public bool requieresPlayer; public bool requieresPlayer;
@ -120,6 +116,34 @@ public class Trap : MonoBehaviour
robberInRange = true; robberInRange = true;
// private string[] trapTypes = new string[] { "Pins", "Rope", "Ladder", "Bear Trap", "Bannana Peel" };
switch (trapType)
{
case "Pins":
break;
case "Rope":
break;
case "Ladder":
break;
case "Bear Trap":
break;
case "Bannana Peel":
break;
default:
Debug.LogError("Unknown trap type. Make sure it's added to the switch statement in FixedUpdate, and not just the context menu. And make sure there aren't any types *looks at nimfer*", this);
break;
}
} }
else else
{ {
@ -132,13 +156,13 @@ public class Trap : MonoBehaviour
{ {
interacted = inputReferences.playerControls.DobberControls.Interact.ReadValue<float>(); interacted = inputReferences.playerControls.DobberControls.Interact.ReadValue<float>();
if (playerInRange) if (playerInRange && !isSet)
{ {
switch (interacted) switch (interacted)
{ {
case 1: case 1:
Debug.Log("trap collected"); Debug.Log("Trap set.");
isSet = false; isSet = true;
GetComponent<MeshRenderer>().sharedMaterial = setMaterial; GetComponent<MeshRenderer>().sharedMaterial = setMaterial;
break; break;
case 0: case 0:
@ -147,13 +171,13 @@ public class Trap : MonoBehaviour
} }
} }
if (robberInRange) if (robberInRange && isSet)
{ {
Debug.Log("The robber has set off the trap."); Debug.Log("The robber has set off the trap.");
isActivated = true;
GetComponent<MeshRenderer>().sharedMaterial = unsetMaterial; GetComponent<MeshRenderer>().sharedMaterial = unsetMaterial;
isSet = false;
wasUsed = true;
} }
} }
} }

View file

@ -0,0 +1,31 @@
using NaughtyAttributes;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WkurwHandler : MonoBehaviour
{
[ProgressBar("Health", 100, EColor.Red)]
public int health = 100;
[ProgressBar("Anger", 100, EColor.Yellow)]
public int anger = 50;
[ProgressBar("Fear", 100, EColor.Blue)]
public int fear = 35;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38918a99291c1d74db80e6685fdc39c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: