Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/BossRoom/GameData/Action/Imp/ImpBaseAttack.asset
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,33 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-5093654682345616202
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AnticipateMove
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 3599037512052606113}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -3419257869308726280, guid: 2115c4661f55eff45a5a0f91fc0a12f0, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-4482486829903005221
AnimatorState:
serializedVersion: 6
Expand Down Expand Up @@ -954,6 +981,7 @@ AnimatorState:
- {fileID: -1751189744513987592}
- {fileID: -3322349416516825559}
- {fileID: 5808351605165405389}
- {fileID: 5286344766070818967}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
Expand Down Expand Up @@ -1316,7 +1344,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NoAttack
m_Name: Nothing
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
Expand Down Expand Up @@ -1401,6 +1429,9 @@ AnimatorStateMachine:
- serializedVersion: 1
m_State: {fileID: 7103618770137260043}
m_Position: {x: -350, y: 330, z: 0}
- serializedVersion: 1
m_State: {fileID: -5093654682345616202}
m_Position: {x: 379.43, y: 329.91626, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions:
- {fileID: 6300214233644051234}
Expand Down Expand Up @@ -1490,6 +1521,28 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-97121490881636740
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -3516404760485336223}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.62071574
m_TransitionOffset: 0.00000004339141
m_ExitTime: 0.0000000041531494
m_HasExitTime: 1
m_HasFixedDuration: 0
m_InterruptionSource: 2
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1637,6 +1690,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: AnticipateMove
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
Expand Down Expand Up @@ -1721,6 +1780,31 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &426919566368059880
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: AnticipateMove
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 7052821593652808675}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.118838675
m_TransitionOffset: 0
m_ExitTime: 0.03151326
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 2
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!114 &462837921949526196
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -2051,6 +2135,28 @@ AnimatorStateMachine:
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -9059899351118470251}
--- !u!1101 &3599037512052606113
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -3516404760485336223}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.35027
m_TransitionOffset: 0.118458696
m_ExitTime: 0.40587464
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 2
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &4047612268588016952
AnimatorStateTransition:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -2279,6 +2385,31 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5286344766070818967
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: AnticipateMove
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -5093654682345616202}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.185271
m_TransitionOffset: 0.051008537
m_ExitTime: 0.031880304
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 2
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5537143230144326077
AnimatorStateTransition:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -2552,6 +2683,33 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &7052821593652808675
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AnticipateMove
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -97121490881636740}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -3419257869308726280, guid: 2115c4661f55eff45a5a0f91fc0a12f0, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &7103618770137260043
AnimatorState:
serializedVersion: 6
Expand Down
9 changes: 8 additions & 1 deletion Assets/BossRoom/Models/CharacterSet.fbx.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ AnimatorOverrideController:
m_OverrideClip: {fileID: -6239216113759591374, guid: 2115c4661f55eff45a5a0f91fc0a12f0, type: 3}
- m_OriginalClip: {fileID: -5612658629409835226, guid: 2115c4661f55eff45a5a0f91fc0a12f0, type: 3}
m_OverrideClip: {fileID: -5612658629409835226, guid: 2115c4661f55eff45a5a0f91fc0a12f0, type: 3}
- m_OriginalClip: {fileID: -4428684883894617094, guid: 2115c4661f55eff45a5a0f91fc0a12f0, type: 3}
m_OverrideClip: {fileID: -3419257869308726280, guid: 2115c4661f55eff45a5a0f91fc0a12f0, type: 3}
6 changes: 3 additions & 3 deletions Assets/BossRoom/Scripts/Client/ClickFeedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ void Start()
}

m_ClientSender = GetComponent<ClientInputSender>();
m_ClientSender.OnClientClick += onClick;
m_ClientSender.ClientMoveEvent += onClientMove;
m_FeedbackObj = Instantiate(m_FeedbackPrefab);
m_FeedbackObj.SetActive(false);
}

void onClick(Vector3 position)
void onClientMove(Vector3 position)
{
position.y += HOVER_HEIGHT;

Expand All @@ -44,7 +44,7 @@ private void OnDestroy()
{
if (m_ClientSender)
{
m_ClientSender.OnClientClick -= onClick;
m_ClientSender.ClientMoveEvent -= onClientMove;
}
}
}
Expand Down
63 changes: 61 additions & 2 deletions Assets/BossRoom/Scripts/Client/Game/Action/ActionFX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public abstract class ActionFX : ActionBase
/// </summary>
public const string k_DefaultHitReact = "HitReact1";

/// <summary>
/// True if this actionFX began running immediately, prior to getting a confirmation from the server.
/// </summary>
public bool Anticipated { get; protected set; }

public ActionFX(ref ActionRequestData data, ClientCharacterVisualization parent) : base(ref data)
{
m_Parent = parent;
Expand All @@ -21,8 +26,16 @@ public ActionFX(ref ActionRequestData data, ClientCharacterVisualization parent)
/// <summary>
/// Starts the ActionFX. Derived classes may return false if they wish to end immediately without their Update being called.
/// </summary>
/// <remarks>
/// Derived class should be sure to call base.Start() in their implementation, but note that this resets "Anticipated" to false.
/// </remarks>
/// <returns>true to play, false to be immediately cleaned up.</returns>
public abstract bool Start();
public virtual bool Start()
{
Anticipated = false; //once you start for real you are no longer an anticipated action.
TimeStartedSeconds = UnityEngine.Time.time;
return true;
}

public abstract bool Update();

Expand Down Expand Up @@ -54,17 +67,63 @@ public static ActionFX MakeActionFX(ref ActionRequestData data, ClientCharacterV
case ActionLogic.RangedFXTargeted: return new FXProjectileTargetedActionFX(ref data, parent);
case ActionLogic.Trample: return new TrampleActionFX(ref data, parent);
case ActionLogic.AoE: return new AoeActionFX(ref data, parent);
case ActionLogic.Stunned: return new AnimationOnlyActionFX(ref data, parent);
case ActionLogic.Target: return new TargetActionFX(ref data, parent);

case ActionLogic.ChargedShield:
case ActionLogic.ChargedLaunchProjectile: return new ChargedActionFX(ref data, parent);

case ActionLogic.StealthMode: return new StealthModeActionFX(ref data, parent);

case ActionLogic.Stunned:
case ActionLogic.LaunchProjectile:
case ActionLogic.Revive:
case ActionLogic.Emote: return new AnimationOnlyActionFX(ref data, parent);

default: throw new System.NotImplementedException();
}
}

/// <summary>
/// Should this ActionFX be created anticipatively on the owning client?
/// </summary>
/// <param name="parent">The ActionVisualization that would be playing this ActionFX.</param>
/// <param name="data">The request being sent to the server</param>
/// <returns>If true ActionVisualization should pre-emptively create the ActionFX on the owning client, before hearing back from the server.</returns>
public static bool ShouldAnticipate(ActionVisualization parent, ref ActionRequestData data)
{
var actionDescription = GameDataSource.Instance.ActionDataByType[data.ActionTypeEnum];

//for actions with ShouldClose set, we check our range locally. If we are out of range, we shouldn't anticipate, as we will
//need to execute a ChaseAction (synthesized on the server) prior to actually playing the skill.
bool isTargetEligible = true;
if( data.ShouldClose == true )
{
ulong targetId = (data.TargetIds != null && data.TargetIds.Length > 0) ? data.TargetIds[0] : 0;
if( MLAPI.Spawning.NetworkSpawnManager.SpawnedObjects.TryGetValue(targetId, out MLAPI.NetworkObject networkObject ) )
{
float rangeSquared = actionDescription.Range * actionDescription.Range;
isTargetEligible = (networkObject.transform.position - parent.Parent.transform.position).sqrMagnitude < rangeSquared;
}
}

//at present all Actionts anticipate except for the Target action, which runs a single instance on the client and is
//responsible for action anticipation on its own.
return isTargetEligible && actionDescription.Logic != ActionLogic.Target;
}

public virtual void OnAnimEvent(string id) { }
public virtual void OnStoppedChargingUp() { }

/// <summary>
/// Called when the action is being "anticipated" on the client. For example, if you are the owner of a tank and you swing your hammer,
/// you get this call immediately on the client, before the server round-trip.
/// Overriders should always call the base class in their implementation!
/// </summary>
public virtual void AnticipateAction()
{
Anticipated = true;
TimeStartedSeconds = UnityEngine.Time.time;
}
}

}
Expand Down
Loading