Add casette gen
This commit is contained in:
parent
cf41dfe4a4
commit
a20432bed8
@ -140,7 +140,10 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
StickPrefab: {fileID: 2086008818391599545, guid: 58a0b048688a1f944ae319d8ee9c5c34,
|
StickPrefab: {fileID: 2086008818391599545, guid: 58a0b048688a1f944ae319d8ee9c5c34,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
CasettePrefab: {fileID: 388935964095823366, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
StickSpawnChance: 0.6
|
StickSpawnChance: 0.6
|
||||||
StickSpawnMinDistance: 15
|
StickSpawnMinDistance: 15
|
||||||
StickSpawnAngle: 70
|
StickSpawnAngle: 70
|
||||||
StickSpawnTimer: 1
|
StickSpawnTimer: 1
|
||||||
|
CasetteChance: 0.1
|
||||||
|
@ -8497,6 +8497,81 @@ Transform:
|
|||||||
type: 3}
|
type: 3}
|
||||||
m_PrefabInstance: {fileID: 203448242}
|
m_PrefabInstance: {fileID: 203448242}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1001 &1060470478
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 1660514110}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 11.46
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 1.51
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: -3.57
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 19
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 388935964095823366, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Casette
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 354995f43a462b04db424bdef965fd1d, type: 3}
|
||||||
|
--- !u!4 &1060470479 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 388935964095823363, guid: 354995f43a462b04db424bdef965fd1d,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1060470478}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1001 &1078260687
|
--- !u!1001 &1078260687
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -11749,134 +11824,6 @@ MeshFilter:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1445458447}
|
m_GameObject: {fileID: 1445458447}
|
||||||
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
--- !u!1 &1456976463
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1456976465}
|
|
||||||
- component: {fileID: 1456976464}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Audio Track Test
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!82 &1456976464
|
|
||||||
AudioSource:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1456976463}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 4
|
|
||||||
OutputAudioMixerGroup: {fileID: -6189427169395524444, guid: 032de345950918c4e89684078c6a7213,
|
|
||||||
type: 2}
|
|
||||||
m_audioClip: {fileID: 8300000, guid: 2b23e5fe1d3f4ff458b43bc8de2322da, type: 3}
|
|
||||||
m_PlayOnAwake: 1
|
|
||||||
m_Volume: 1
|
|
||||||
m_Pitch: 1
|
|
||||||
Loop: 0
|
|
||||||
Mute: 0
|
|
||||||
Spatialize: 0
|
|
||||||
SpatializePostEffects: 0
|
|
||||||
Priority: 128
|
|
||||||
DopplerLevel: 1
|
|
||||||
MinDistance: 1
|
|
||||||
MaxDistance: 500
|
|
||||||
Pan2D: 0
|
|
||||||
rolloffMode: 0
|
|
||||||
BypassEffects: 0
|
|
||||||
BypassListenerEffects: 0
|
|
||||||
BypassReverbZones: 0
|
|
||||||
rolloffCustomCurve:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Curve:
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 0
|
|
||||||
value: 1
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0.33333334
|
|
||||||
outWeight: 0.33333334
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 1
|
|
||||||
value: 0
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0.33333334
|
|
||||||
outWeight: 0.33333334
|
|
||||||
m_PreInfinity: 2
|
|
||||||
m_PostInfinity: 2
|
|
||||||
m_RotationOrder: 4
|
|
||||||
panLevelCustomCurve:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Curve:
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 0
|
|
||||||
value: 0
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0.33333334
|
|
||||||
outWeight: 0.33333334
|
|
||||||
m_PreInfinity: 2
|
|
||||||
m_PostInfinity: 2
|
|
||||||
m_RotationOrder: 4
|
|
||||||
spreadCustomCurve:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Curve:
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 0
|
|
||||||
value: 0
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0.33333334
|
|
||||||
outWeight: 0.33333334
|
|
||||||
m_PreInfinity: 2
|
|
||||||
m_PostInfinity: 2
|
|
||||||
m_RotationOrder: 4
|
|
||||||
reverbZoneMixCustomCurve:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Curve:
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 0
|
|
||||||
value: 1
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0.33333334
|
|
||||||
outWeight: 0.33333334
|
|
||||||
m_PreInfinity: 2
|
|
||||||
m_PostInfinity: 2
|
|
||||||
m_RotationOrder: 4
|
|
||||||
--- !u!4 &1456976465
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1456976463}
|
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
|
||||||
m_LocalPosition: {x: 89.40187, y: -69.87285, z: -88.22499}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 5
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1001 &1457481734
|
--- !u!1001 &1457481734
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -13750,6 +13697,7 @@ Transform:
|
|||||||
- {fileID: 675824347}
|
- {fileID: 675824347}
|
||||||
- {fileID: 2009628691}
|
- {fileID: 2009628691}
|
||||||
- {fileID: 1309454697}
|
- {fileID: 1309454697}
|
||||||
|
- {fileID: 1060470479}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -18852,7 +18800,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259,
|
- target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: Regen
|
propertyPath: Regen
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259,
|
- target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
@ -5,17 +5,22 @@ using UnityEngine;
|
|||||||
public class StickSpawner : MonoBehaviour {
|
public class StickSpawner : MonoBehaviour {
|
||||||
|
|
||||||
public GameObject StickPrefab;
|
public GameObject StickPrefab;
|
||||||
|
public GameObject CasettePrefab;
|
||||||
|
|
||||||
public float StickSpawnChance = 0.5f;
|
public float StickSpawnChance = 0.5f;
|
||||||
public float StickSpawnMinDistance = 5f;
|
public float StickSpawnMinDistance = 5f;
|
||||||
public float StickSpawnAngle = 70f;
|
public float StickSpawnAngle = 70f;
|
||||||
public float StickSpawnTimer = 2f;
|
public float StickSpawnTimer = 2f;
|
||||||
|
|
||||||
|
public float CasetteChance = 0.2f;
|
||||||
|
|
||||||
private GameObject Player;
|
private GameObject Player;
|
||||||
|
|
||||||
private float LastSpawn;
|
private float LastSpawn;
|
||||||
private bool CanSpawnNew = true;
|
private bool CanSpawnNew = true;
|
||||||
|
private bool LastSpawnedWasCasette = false;
|
||||||
private Item SpawnedStick = null;
|
private Item SpawnedStick = null;
|
||||||
|
private CasettePickup SpawnedCasette = null;
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
Player = GameObject.FindGameObjectWithTag("Player");
|
Player = GameObject.FindGameObjectWithTag("Player");
|
||||||
@ -24,7 +29,7 @@ public class StickSpawner : MonoBehaviour {
|
|||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
if (!CanSpawnNew) {
|
if (!CanSpawnNew) {
|
||||||
if (SpawnedStick.Grabbed) {
|
if ((LastSpawnedWasCasette && (SpawnedCasette == null || SpawnedCasette.PickedUp)) || (!LastSpawnedWasCasette && SpawnedStick.Grabbed)) {
|
||||||
CanSpawnNew = true;
|
CanSpawnNew = true;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@ -39,9 +44,20 @@ public class StickSpawner : MonoBehaviour {
|
|||||||
|
|
||||||
var dir = transform.position - Player.transform.position;
|
var dir = transform.position - Player.transform.position;
|
||||||
if ((Vector3.Angle(Player.transform.forward, dir) > StickSpawnAngle) || dir.magnitude > StickSpawnMinDistance && Random.value <= StickSpawnChance) {
|
if ((Vector3.Angle(Player.transform.forward, dir) > StickSpawnAngle) || dir.magnitude > StickSpawnMinDistance && Random.value <= StickSpawnChance) {
|
||||||
|
var SpawnedThing = StickPrefab;
|
||||||
|
if (Random.value <= CasetteChance) {
|
||||||
|
SpawnedThing = CasettePrefab;
|
||||||
|
LastSpawnedWasCasette = true;
|
||||||
|
} else {
|
||||||
|
LastSpawnedWasCasette = false;
|
||||||
|
}
|
||||||
CanSpawnNew = false;
|
CanSpawnNew = false;
|
||||||
var Stick = GameObject.Instantiate(StickPrefab, transform.position + Vector3.up * 2, Random.rotation);
|
var Stick = GameObject.Instantiate(SpawnedThing, transform.position + Vector3.up * 2, Random.rotation);
|
||||||
SpawnedStick = Stick.GetComponent<Item>();
|
if (LastSpawnedWasCasette) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
SpawnedStick = Stick.GetComponent<Item>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user