the sun is leaking.
This commit is contained in:
parent
43a0b83748
commit
b968ed3060
4 changed files with 212 additions and 70 deletions
|
|
@ -289,6 +289,8 @@ MonoBehaviour:
|
||||||
rb: {fileID: 3678290925386274447}
|
rb: {fileID: 3678290925386274447}
|
||||||
speed: 6
|
speed: 6
|
||||||
closestTarget: {fileID: 0}
|
closestTarget: {fileID: 0}
|
||||||
|
engagementRange: 10
|
||||||
|
detectedPlayer: 0
|
||||||
acceleration: 1000
|
acceleration: 1000
|
||||||
possibleDirections:
|
possibleDirections:
|
||||||
- {fileID: 6161020943054912188}
|
- {fileID: 6161020943054912188}
|
||||||
|
|
|
||||||
|
|
@ -712,6 +712,39 @@ SpriteRenderer:
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1 &844020319
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 844020320}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: SpawnPoints
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &844020320
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 844020319}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 1606209485}
|
||||||
|
- {fileID: 2000423408}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1108889697
|
--- !u!1 &1108889697
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -799,6 +832,37 @@ SpriteRenderer:
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1 &1319590956
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1319590957}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: EnemyFolder
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1319590957
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1319590956}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &1582287016 stripped
|
--- !u!114 &1582287016 stripped
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_CorrespondingSourceObject: {fileID: 5275979051295637757, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
m_CorrespondingSourceObject: {fileID: 5275979051295637757, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3}
|
||||||
|
|
@ -810,6 +874,37 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 52bda12b42435d197a10a340f8608249, type: 3}
|
m_Script: {fileID: 11500000, guid: 52bda12b42435d197a10a340f8608249, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1 &1606209484
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1606209485}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: SpawnPoint1
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1606209485
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1606209484}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -7.1, y: 0.09, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 844020320}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1683661727
|
--- !u!1 &1683661727
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -932,78 +1027,99 @@ SpriteRenderer:
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
--- !u!1001 &1100043509840210754
|
--- !u!1 &1972076833
|
||||||
PrefabInstance:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1972076835}
|
||||||
|
- component: {fileID: 1972076834}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: EnemySpawner
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &1972076834
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1972076833}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1feaa0eb8751bf4a1b4acb1457d0c538, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
player: {fileID: 1582287016}
|
||||||
|
enemiesToSpawn:
|
||||||
|
- {fileID: 2525771944862034798, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
||||||
|
spawnPoints:
|
||||||
|
- {fileID: 1606209485}
|
||||||
|
- {fileID: 2000423408}
|
||||||
|
spawnRate: 2
|
||||||
|
currentSpawnTime: 0
|
||||||
|
enemyFolder: {fileID: 1319590957}
|
||||||
|
--- !u!4 &1972076835
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1972076833}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Modification:
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
serializedVersion: 3
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_TransformParent: {fileID: 0}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Modifications:
|
m_ConstrainProportionsScale: 0
|
||||||
- target: {fileID: 2525771944862034798, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
m_Children: []
|
||||||
propertyPath: closestTarget
|
m_Father: {fileID: 0}
|
||||||
value:
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
objectReference: {fileID: 1582287016}
|
--- !u!1 &2000423407
|
||||||
- target: {fileID: 7987017199152692169, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
GameObject:
|
||||||
propertyPath: m_Name
|
m_ObjectHideFlags: 0
|
||||||
value: Enemy
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
objectReference: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
- target: {fileID: 7987017199152692169, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
m_PrefabAsset: {fileID: 0}
|
||||||
propertyPath: m_IsActive
|
serializedVersion: 6
|
||||||
value: 0
|
m_Component:
|
||||||
objectReference: {fileID: 0}
|
- component: {fileID: 2000423408}
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
m_Layer: 0
|
||||||
propertyPath: m_LocalPosition.x
|
m_Name: SpawnPoint2
|
||||||
value: -4.103
|
m_TagString: Untagged
|
||||||
objectReference: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
m_NavMeshLayer: 0
|
||||||
propertyPath: m_LocalPosition.y
|
m_StaticEditorFlags: 0
|
||||||
value: -0.166
|
m_IsActive: 1
|
||||||
objectReference: {fileID: 0}
|
--- !u!4 &2000423408
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
Transform:
|
||||||
propertyPath: m_LocalPosition.z
|
m_ObjectHideFlags: 0
|
||||||
value: 0
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
objectReference: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
m_PrefabAsset: {fileID: 0}
|
||||||
propertyPath: m_LocalRotation.w
|
m_GameObject: {fileID: 2000423407}
|
||||||
value: 1
|
serializedVersion: 2
|
||||||
objectReference: {fileID: 0}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
m_LocalPosition: {x: 6.25, y: -0.11, z: 0}
|
||||||
propertyPath: m_LocalRotation.x
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
value: -0
|
m_ConstrainProportionsScale: 0
|
||||||
objectReference: {fileID: 0}
|
m_Children: []
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
m_Father: {fileID: 844020320}
|
||||||
propertyPath: m_LocalRotation.y
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
value: -0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: -0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 8365993665657711315, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_RemovedGameObjects: []
|
|
||||||
m_AddedGameObjects: []
|
|
||||||
m_AddedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 063e01ce3891d882e88d10b67e7f9f7b, type: 3}
|
|
||||||
--- !u!1660057539 &9223372036854775807
|
--- !u!1660057539 &9223372036854775807
|
||||||
SceneRoots:
|
SceneRoots:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_Roots:
|
m_Roots:
|
||||||
- {fileID: 519420032}
|
- {fileID: 519420032}
|
||||||
|
- {fileID: 1972076835}
|
||||||
- {fileID: 619394802}
|
- {fileID: 619394802}
|
||||||
- {fileID: 583397146}
|
- {fileID: 583397146}
|
||||||
- {fileID: 1100043509840210754}
|
|
||||||
- {fileID: 394036755}
|
- {fileID: 394036755}
|
||||||
- {fileID: 1683661728}
|
- {fileID: 1683661728}
|
||||||
|
- {fileID: 844020320}
|
||||||
|
- {fileID: 1319590957}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ using UnityEngine;
|
||||||
public class Enemy : Entity
|
public class Enemy : Entity
|
||||||
{
|
{
|
||||||
[Header("Targetting")]
|
[Header("Targetting")]
|
||||||
public Entity closestTarget;
|
public Entity closestTarget;
|
||||||
|
public float engagementRange;
|
||||||
|
public bool detectedPlayer = false;
|
||||||
[Header("Direction")]
|
[Header("Direction")]
|
||||||
public float acceleration;
|
public float acceleration;
|
||||||
public Transform[] possibleDirections;
|
public Transform[] possibleDirections;
|
||||||
|
|
@ -23,7 +25,11 @@ public class Enemy : Entity
|
||||||
|
|
||||||
protected override void FixedUpdate()
|
protected override void FixedUpdate()
|
||||||
{
|
{
|
||||||
if (stalled || !closestTarget)
|
if (!detectedPlayer && Vector3.Distance(transform.position, closestTarget.transform.position) < engagementRange)
|
||||||
|
{
|
||||||
|
detectedPlayer = true;
|
||||||
|
}
|
||||||
|
if (stalled || !closestTarget || !detectedPlayer)
|
||||||
{
|
{
|
||||||
rb.VelocityTowards(Vector2.zero.ScaleToMagnitude(speed), acceleration);
|
rb.VelocityTowards(Vector2.zero.ScaleToMagnitude(speed), acceleration);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,31 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
public class EnemySpawner : MonoBehaviour
|
public class EnemySpawner : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] private Marisa player;
|
||||||
public Enemy[] enemiesToSpawn;
|
public Enemy[] enemiesToSpawn;
|
||||||
|
public List<Transform> spawnPoints;
|
||||||
public float spawnRate;
|
public float spawnRate;
|
||||||
public float currentSpawnTime;
|
[SerializeField] private float currentSpawnTime;
|
||||||
|
[SerializeField] private Transform enemyFolder;
|
||||||
public void SpawnEnemy()
|
|
||||||
|
private void Update()
|
||||||
{
|
{
|
||||||
|
currentSpawnTime -= Time.deltaTime;
|
||||||
|
if (currentSpawnTime < 0)
|
||||||
|
{
|
||||||
|
currentSpawnTime = spawnRate;
|
||||||
|
SpawnEnemy(enemiesToSpawn[Random.Range(0, enemiesToSpawn.Length)], spawnPoints[Random.Range(0, spawnPoints.Count)].position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SpawnEnemy(Enemy enemy, Vector3 location)
|
||||||
|
{
|
||||||
|
Enemy newEnemy = Instantiate(enemy, location, Quaternion.identity);
|
||||||
|
newEnemy.transform.SetParent(enemyFolder);
|
||||||
|
newEnemy.closestTarget = player; //idk if there's actually gonna be any other target lol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue