Pull request #11: Jason
Merge in CEGJ/ludumdare50 from jason to dev * commit '20d5e2c41154660ec1aa124b9c9f9060908aec5d': Add minion icon on selector bar Check IsTargetable in FindTarget Added GameFlowState change update to kill velocity Replaced circle collider by flat capsule Sped up cam zoom and started when entering safe zone Fixed minion cooldown starting half way in build
This commit is contained in:
commit
577fbcbfe4
@ -114,7 +114,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 0, g: 0, b: 0, a: 1}
|
m_Color: {r: 0, g: 0, b: 0, a: 0.5019608}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
@ -158,7 +158,7 @@ RectTransform:
|
|||||||
m_GameObject: {fileID: 1979632679604795357}
|
m_GameObject: {fileID: 1979632679604795357}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 2.5, y: 2.5, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1979632678310270258}
|
m_Father: {fileID: 1979632678310270258}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
@ -166,7 +166,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: -20, y: -20}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &1979632679604795352
|
--- !u!222 &1979632679604795352
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
|
|||||||
@ -652,7 +652,7 @@ MonoBehaviour:
|
|||||||
m_BlendUpdateMethod: 0
|
m_BlendUpdateMethod: 0
|
||||||
m_DefaultBlend:
|
m_DefaultBlend:
|
||||||
m_Style: 1
|
m_Style: 1
|
||||||
m_Time: 2
|
m_Time: 1
|
||||||
m_CustomCurve:
|
m_CustomCurve:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Curve: []
|
m_Curve: []
|
||||||
|
|||||||
@ -15,7 +15,7 @@ GameObject:
|
|||||||
- component: {fileID: 7967951869135974023}
|
- component: {fileID: 7967951869135974023}
|
||||||
- component: {fileID: 1214567908930553477}
|
- component: {fileID: 1214567908930553477}
|
||||||
- component: {fileID: 945832017}
|
- component: {fileID: 945832017}
|
||||||
- component: {fileID: 945832018}
|
- component: {fileID: 7270464587938865433}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Vampire
|
m_Name: Vampire
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -337,8 +337,8 @@ Rigidbody2D:
|
|||||||
m_SleepingMode: 1
|
m_SleepingMode: 1
|
||||||
m_CollisionDetection: 0
|
m_CollisionDetection: 0
|
||||||
m_Constraints: 4
|
m_Constraints: 4
|
||||||
--- !u!58 &945832018
|
--- !u!70 &7270464587938865433
|
||||||
CircleCollider2D:
|
CapsuleCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
@ -350,9 +350,9 @@ CircleCollider2D:
|
|||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_UsedByEffector: 0
|
m_UsedByEffector: 0
|
||||||
m_UsedByComposite: 0
|
m_UsedByComposite: 0
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: -0.25}
|
||||||
serializedVersion: 2
|
m_Size: {x: 1.25, y: 0.5}
|
||||||
m_Radius: 0.5
|
m_Direction: 1
|
||||||
--- !u!1 &5124059627794595469
|
--- !u!1 &5124059627794595469
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -409,8 +409,8 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 5933636161494595212}
|
m_GameObject: {fileID: 5933636161494595212}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: -1, z: 0}
|
m_LocalPosition: {x: 0, y: -0.5, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 0.3, z: 1}
|
m_LocalScale: {x: 1.2, y: 0.3, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1214567908930553594}
|
m_Father: {fileID: 1214567908930553594}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 3
|
||||||
@ -492,7 +492,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 6851233285413272648}
|
m_GameObject: {fileID: 6851233285413272648}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0.5, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1214567908930553594}
|
m_Father: {fileID: 1214567908930553594}
|
||||||
|
|||||||
@ -208,10 +208,6 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: SceneStuff
|
value: SceneStuff
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8365024802335227869, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
|
|
||||||
propertyPath: orthographic size
|
|
||||||
value: 10.5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
|
||||||
--- !u!4 &720678398 stripped
|
--- !u!4 &720678398 stripped
|
||||||
|
|||||||
@ -209,12 +209,17 @@ public class AIEntity : Entity {
|
|||||||
float lastDist = float.MaxValue;
|
float lastDist = float.MaxValue;
|
||||||
Transform chosenEntity = null!;
|
Transform chosenEntity = null!;
|
||||||
foreach (Transform other in entityParent) {// Find the closest entity
|
foreach (Transform other in entityParent) {// Find the closest entity
|
||||||
float distance = Vector2.Distance(other.position, entity.transform.position);
|
if (other.GetComponent<Entity>() is {} otherEntity) {
|
||||||
if (distance < lastDist) {
|
if (entity.IsTargetable(otherEntity)) {
|
||||||
lastDist = distance;
|
float distance = Vector2.Distance(other.position, entity.transform.position);
|
||||||
chosenEntity = other;
|
if (distance < lastDist) {
|
||||||
if (lastDist <= entity.AIStats.closeEnough) break;
|
lastDist = distance;
|
||||||
}
|
chosenEntity = other;
|
||||||
|
if (lastDist <= entity.AIStats.closeEnough)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chosenEntity != null) {
|
if (chosenEntity != null) {
|
||||||
|
|||||||
@ -54,6 +54,7 @@ public class Entity : MonoBehaviour {
|
|||||||
protected virtual void Start() {
|
protected virtual void Start() {
|
||||||
if (direction == Vector3.zero && !(this is VampireEntity))
|
if (direction == Vector3.zero && !(this is VampireEntity))
|
||||||
Debug.LogWarning("Entity had null direction.");
|
Debug.LogWarning("Entity had null direction.");
|
||||||
|
gameFlowManager.stateChanged += OnGameFlowStateChanged;
|
||||||
|
|
||||||
attackTimer = attackCooldown;
|
attackTimer = attackCooldown;
|
||||||
initialHealth = Health;
|
initialHealth = Health;
|
||||||
@ -66,6 +67,8 @@ public class Entity : MonoBehaviour {
|
|||||||
|
|
||||||
protected virtual void FixedUpdate() {}
|
protected virtual void FixedUpdate() {}
|
||||||
|
|
||||||
|
protected void OnDestroy() => gameFlowManager.stateChanged -= OnGameFlowStateChanged;
|
||||||
|
|
||||||
protected virtual void Attack() {
|
protected virtual void Attack() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -156,4 +159,9 @@ public class Entity : MonoBehaviour {
|
|||||||
public void DisableHalo() {
|
public void DisableHalo() {
|
||||||
halo.SetActive(false);
|
halo.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnGameFlowStateChanged(BaseState newState) {
|
||||||
|
if (gameFlowManager.pauseLevel >= GameFlowManager.PauseLevel.NothingMoves)
|
||||||
|
rb.velocity = Vector2.zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System;
|
||||||
using NaughtyAttributes;
|
using NaughtyAttributes;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
@ -37,6 +38,8 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
[field: SerializeField] TMP_Text startTxt;
|
[field: SerializeField] TMP_Text startTxt;
|
||||||
[field: SerializeField] TMP_Text endTxt;
|
[field: SerializeField] TMP_Text endTxt;
|
||||||
|
|
||||||
|
public event Action<BaseState> stateChanged;
|
||||||
|
|
||||||
#region Unity Messages
|
#region Unity Messages
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
@ -129,9 +132,10 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
CurrentState.LeaveState();
|
CurrentState.LeaveState();
|
||||||
CurrentState = newState;
|
CurrentState = newState;
|
||||||
newState.EnterState();
|
newState.EnterState();
|
||||||
|
stateChanged?.Invoke(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class GameFlowState : BaseState {
|
public abstract class GameFlowState : BaseState {
|
||||||
readonly protected GameFlowManager gameFlowManager;
|
readonly protected GameFlowManager gameFlowManager;
|
||||||
|
|
||||||
protected GameFlowState(GameFlowManager gameFlowManager) {
|
protected GameFlowState(GameFlowManager gameFlowManager) {
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public class MinionThrower : MonoBehaviour {
|
|||||||
foreach (Entity minion in minionPrefabs) {
|
foreach (Entity minion in minionPrefabs) {
|
||||||
minionBar.AddMinionType(minion);
|
minionBar.AddMinionType(minion);
|
||||||
}
|
}
|
||||||
|
minionBar.UpdateReload(0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedUpdate() {
|
void FixedUpdate() {
|
||||||
|
|||||||
@ -218,7 +218,8 @@ public class PlayerMovement : MonoBehaviour {
|
|||||||
|
|
||||||
public override void EnterState() {
|
public override void EnterState() {
|
||||||
base.EnterState();
|
base.EnterState();
|
||||||
|
|
||||||
|
playerMovement.globalCamera.SetActive(true);
|
||||||
playerMovement.rb.SetEnabled(false);
|
playerMovement.rb.SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,10 +16,6 @@ public class MinionBar : MonoBehaviour {
|
|||||||
minionIcons = new List<MinionIcon>();
|
minionIcons = new List<MinionIcon>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start() {
|
|
||||||
UpdateReload(0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeSelectedIcon(InputAction.CallbackContext context) {
|
public void ChangeSelectedIcon(InputAction.CallbackContext context) {
|
||||||
|
|
||||||
float floatDelta = context.ReadValue<float>();
|
float floatDelta = context.ReadValue<float>();
|
||||||
@ -45,9 +41,11 @@ public class MinionBar : MonoBehaviour {
|
|||||||
|
|
||||||
public void AddMinionType(Entity newMinionPrefab) {
|
public void AddMinionType(Entity newMinionPrefab) {
|
||||||
minionTypes.Add(newMinionPrefab);
|
minionTypes.Add(newMinionPrefab);
|
||||||
MinionIcon newIcon = Instantiate(minionIconPrefab, transform).GetComponent<MinionIcon>();
|
MinionIcon newIcon = Instantiate(minionIconPrefab, transform)
|
||||||
|
.GetComponent<MinionIcon>();
|
||||||
minionIcons.Add(newIcon);
|
minionIcons.Add(newIcon);
|
||||||
// minionIcons[i].icon = minionTypes.icon; // TODO
|
newIcon.icon.sprite = newMinionPrefab.renderer.sprite;
|
||||||
|
newIcon.icon.preserveAspect = true;
|
||||||
newIcon.indexInMinionList = minionIcons.Count;
|
newIcon.indexInMinionList = minionIcons.Count;
|
||||||
if (currentIndex == minionIcons.Count - 1) {
|
if (currentIndex == minionIcons.Count - 1) {
|
||||||
newIcon.Select();
|
newIcon.Select();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user