Timeline works YAY
This commit is contained in:
1 parent
6114192055
commit
7098d938a7
84 files changed
+96509
-51755
No files matched your search
@@ -0,0 +1,11 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public abstract class BattleAction
|
||||
{
|
||||
public bool Finished { get; protected set; }
|
||||
public abstract void Tick(float tickDelta);
|
||||
public abstract UniTask DecideAction();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9dcb8a4911af4d4eac5ec4e36ba3931e
|
||||
timeCreated: 1792691630
|
||||
@@ -0,0 +1,26 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using KinematicCharacterController;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public class BattleActionMove : BattleAction
|
||||
{
|
||||
private NavMeshPath _path = new();
|
||||
private Vector3 _endPosition;
|
||||
public override void Tick(float tickDelta)
|
||||
{
|
||||
KinematicCharacterSystem.Simulate(
|
||||
tickDelta,
|
||||
KinematicCharacterSystem.CharacterMotors,
|
||||
KinematicCharacterSystem.PhysicsMovers
|
||||
);
|
||||
}
|
||||
|
||||
public override async UniTask DecideAction()
|
||||
{
|
||||
_endPosition = new Vector3(0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00995677816949ec99d2bd3546ec6597
|
||||
timeCreated: 1792691686
|
||||
@@ -0,0 +1,21 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public class BattleActionWait : BattleAction
|
||||
{
|
||||
private int _waitFrames;
|
||||
public override void Tick(float tickDelta)
|
||||
{
|
||||
_waitFrames--;
|
||||
if (_waitFrames <= 0) Finished = true;
|
||||
}
|
||||
|
||||
public override async UniTask DecideAction()
|
||||
{
|
||||
Finished = false;
|
||||
|
||||
_waitFrames = 120;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5af678ef30f04b7093df4488ed133bff
|
||||
timeCreated: 1792691714
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public struct BattleActionWaitParameters
|
||||
{
|
||||
public int FrameCount;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fa4aebfa3f24cc3aec7dfc2c2ffab37
|
||||
timeCreated: 1792478259
|
||||
@@ -1,19 +0,0 @@
|
||||
using Code.OfficeGame.BattleMode.Timeline;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public static class BattleEntityActionMethods
|
||||
{
|
||||
public static TimelineBattleAction Move(EntityActionMaker entityActionMaker, Vector3 position)
|
||||
{
|
||||
|
||||
return new TimelineBattleAction(){};
|
||||
}
|
||||
public static TimelineBattleAction Wait(EntityActionMaker entityActionMaker, BattleActionWaitParameters position)
|
||||
{
|
||||
|
||||
return new TimelineBattleAction(){};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 527237749fe248a7a5cf0c357e370a4e
|
||||
timeCreated: 1792477820
|
||||
@@ -1,12 +0,0 @@
|
||||
using Code.OfficeGame.BattleMode.Timeline;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public class EntityActionMaker : MonoBehaviour
|
||||
{
|
||||
public TimelineBattleAction TimelineCurrentAction { get; private set;}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public abstract class EntityTimelineActor : MonoBehaviour
|
||||
{
|
||||
public BattleAction CurrentAction { get; protected set;}
|
||||
public bool Finished => CurrentAction == null || CurrentAction.Finished;
|
||||
|
||||
public abstract UniTask DecideAction(CancellationToken ct);
|
||||
|
||||
public Animator animator;
|
||||
|
||||
protected Dictionary<BattleActionType, BattleAction> BattleActions = new();
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cef19ac17a4548c891293420fafa0b3f
|
||||
timeCreated: 1792693326
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions.Player
|
||||
{
|
||||
public class PlayerTimelineActor : EntityTimelineActor
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
BattleActions.Add(BattleActionType.Wait, new BattleActionWait());
|
||||
}
|
||||
|
||||
public override async UniTask DecideAction(CancellationToken ct)
|
||||
{
|
||||
var decidedAction = BattleActionType.Wait; // T
|
||||
|
||||
Debug.Log("player decided to wait");
|
||||
|
||||
await BattleActions[decidedAction].DecideAction();
|
||||
|
||||
CurrentAction = BattleActions[decidedAction];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9f637cef8714ef1b5ec779d21630ebd
|
||||
timeCreated: 1792693336
|
||||
Reference in new issue
Block a user