Data cleanup
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
1578eb3780
commit
ceb4786228
@ -183,21 +183,25 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type" : "FALL",
|
"type" : "FALL",
|
||||||
"animationFall" : {
|
"fallState" : {
|
||||||
"name" : "Fall",
|
"firstPersonAnimation" : {
|
||||||
"length" : 1,
|
"name" : "Fall",
|
||||||
"loops" : true
|
"priority": 4
|
||||||
|
},
|
||||||
|
"thirdPersonAnimation" : {
|
||||||
|
"name" : "Fall",
|
||||||
|
"priority": 4
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"animationFirstPersonFall" : {
|
"landState" : {
|
||||||
"name" : "Fall"
|
"firstPersonAnimation" : {
|
||||||
},
|
"name" : "Land",
|
||||||
"animationLand" : {
|
"priority": 4
|
||||||
"name" : "Land",
|
},
|
||||||
"length" : 1,
|
"thirdPersonAnimation" : {
|
||||||
"loops" : true
|
"name" : "Land",
|
||||||
},
|
"priority": 4
|
||||||
"animationFirstPersonLand" : {
|
}
|
||||||
"name" : "Land"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -7,6 +7,10 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
||||||
|
import electrosphere.game.data.common.TreeDataAnimation;
|
||||||
|
import electrosphere.game.data.common.TreeDataAudio;
|
||||||
|
import electrosphere.game.data.common.TreeDataState;
|
||||||
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.renderer.actor.Actor;
|
import electrosphere.renderer.actor.Actor;
|
||||||
import electrosphere.server.poseactor.PoseActor;
|
import electrosphere.server.poseactor.PoseActor;
|
||||||
|
|
||||||
@ -79,7 +83,7 @@ public class StateTransitionUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(state == null){
|
if(state == null){
|
||||||
throw new IllegalArgumentException("Trying to simulate state that is not registered with this util object");
|
LoggerInterface.loggerEngine.DEBUG("Skipping state " + stateEnum + " because there is not a state registered to that enum value!");
|
||||||
} else {
|
} else {
|
||||||
if(this.isServer){
|
if(this.isServer){
|
||||||
simulateServerState(this.parent,state);
|
simulateServerState(this.parent,state);
|
||||||
@ -98,49 +102,43 @@ public class StateTransitionUtil {
|
|||||||
Actor actor = EntityUtils.getActor(parent);
|
Actor actor = EntityUtils.getActor(parent);
|
||||||
if(actor != null){
|
if(actor != null){
|
||||||
//determine the third person animation to play
|
//determine the third person animation to play
|
||||||
String animationToPlay = state.thirdPersonAnimation;
|
String thirdPersonAnimation = state.getThirdPersonAnimation();
|
||||||
if(animationToPlay == null && state.getThirdPersonAnimation != null){
|
|
||||||
animationToPlay = state.getThirdPersonAnimation.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
//determine the first person animation to play
|
//determine the first person animation to play
|
||||||
String firstPersonAnimation = state.firstPersonAnimation;
|
String firstPersonAnimation = state.getFirstPersonAnimation();
|
||||||
if(firstPersonAnimation == null && state.getFirstPersonAnimation != null){
|
|
||||||
firstPersonAnimation = state.getFirstPersonAnimation.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Main simulation
|
//Main simulation
|
||||||
if(!actor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true){
|
if(!actor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true && thirdPersonAnimation != null){
|
||||||
//state transition if this isn't set to loop
|
//state transition if this isn't set to loop
|
||||||
state.onComplete.run();
|
state.onComplete.run();
|
||||||
state.startedAnimation = false;
|
state.startedAnimation = false;
|
||||||
} else if(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(animationToPlay)){
|
} else if(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(thirdPersonAnimation)){
|
||||||
//play animation, audio, etc, for state
|
//play animation, audio, etc, for state
|
||||||
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson() && thirdPersonAnimation != null){
|
||||||
//first person
|
//first person
|
||||||
//play first person audio
|
//play first person audio
|
||||||
if(state.audioPath != null){
|
if(state.audioData != null && state.audioData.getAudioPath() != null){
|
||||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(state.audioPath, VirtualAudioSourceType.CREATURE, false);
|
Globals.virtualAudioSourceManager.createVirtualAudioSource(state.audioData.getAudioPath(), VirtualAudioSourceType.CREATURE, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//play third person audio
|
//play third person audio
|
||||||
if(state.audioPath != null){
|
if(state.audioData != null && state.audioData.getAudioPath() != null){
|
||||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(state.audioPath, VirtualAudioSourceType.CREATURE, false, EntityUtils.getPosition(parent));
|
Globals.virtualAudioSourceManager.createVirtualAudioSource(state.audioData.getAudioPath(), VirtualAudioSourceType.CREATURE, false, EntityUtils.getPosition(parent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actor.playAnimation(animationToPlay,state.animPriority);
|
actor.playAnimation(thirdPersonAnimation,state.getAnimationPriority());
|
||||||
actor.incrementAnimationTime(0.0001);
|
actor.incrementAnimationTime(0.0001);
|
||||||
state.startedAnimation = true;
|
state.startedAnimation = true;
|
||||||
} else if(animationToPlay == null && state.onComplete != null){
|
} else if(thirdPersonAnimation == null && state.onComplete != null){
|
||||||
state.onComplete.run();
|
state.onComplete.run();
|
||||||
state.startedAnimation = false;
|
state.startedAnimation = false;
|
||||||
}
|
}
|
||||||
if(firstPersonAnimation != null){
|
if(firstPersonAnimation != null){
|
||||||
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, firstPersonAnimation, state.animPriority);
|
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, firstPersonAnimation, state.getAnimationPriority());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,23 +152,20 @@ public class StateTransitionUtil {
|
|||||||
PoseActor poseActor = EntityUtils.getPoseActor(parent);
|
PoseActor poseActor = EntityUtils.getPoseActor(parent);
|
||||||
if(poseActor != null){
|
if(poseActor != null){
|
||||||
//determine the third person animation to play
|
//determine the third person animation to play
|
||||||
String animationToPlay = state.thirdPersonAnimation;
|
String thirdPersonAnimation = state.getThirdPersonAnimation();
|
||||||
if(animationToPlay == null && state.getThirdPersonAnimation != null){
|
|
||||||
animationToPlay = state.getThirdPersonAnimation.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Main simulation
|
//Main simulation
|
||||||
if(!poseActor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true){
|
if(!poseActor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true && thirdPersonAnimation != null){
|
||||||
//state transition if this isn't set to loop
|
//state transition if this isn't set to loop
|
||||||
state.onComplete.run();
|
state.onComplete.run();
|
||||||
state.startedAnimation = false;
|
state.startedAnimation = false;
|
||||||
} else if(animationToPlay != null && (!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay))){
|
} else if(thirdPersonAnimation != null && (!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(thirdPersonAnimation))){
|
||||||
//play animation for state
|
//play animation for state
|
||||||
poseActor.playAnimation(animationToPlay,state.animPriority);
|
poseActor.playAnimation(thirdPersonAnimation,state.getAnimationPriority());
|
||||||
poseActor.incrementAnimationTime(0.0001);
|
poseActor.incrementAnimationTime(0.0001);
|
||||||
state.startedAnimation = true;
|
state.startedAnimation = true;
|
||||||
} else if(animationToPlay == null && state.onComplete != null){
|
} else if(thirdPersonAnimation == null && state.onComplete != null){
|
||||||
state.onComplete.run();
|
state.onComplete.run();
|
||||||
state.startedAnimation = false;
|
state.startedAnimation = false;
|
||||||
}
|
}
|
||||||
@ -188,20 +183,20 @@ public class StateTransitionUtil {
|
|||||||
//the priority of this animation in particular
|
//the priority of this animation in particular
|
||||||
int animPriority;
|
int animPriority;
|
||||||
|
|
||||||
//T1he animation to play in first person
|
//The animation to play in first person
|
||||||
String firstPersonAnimation;
|
TreeDataAnimation firstPersonAnimation;
|
||||||
|
|
||||||
//Gets the first person animation's name
|
//Gets the first person animation's name
|
||||||
Supplier<String> getFirstPersonAnimation;
|
Supplier<String> getFirstPersonAnimation;
|
||||||
|
|
||||||
//The animation to play in third person
|
//The animation to play in third person
|
||||||
String thirdPersonAnimation;
|
TreeDataAnimation thirdPersonAnimation;
|
||||||
|
|
||||||
//Gets the third person animation's name
|
//Gets the third person animation's name
|
||||||
Supplier<String> getThirdPersonAnimation;
|
Supplier<String> getThirdPersonAnimation;
|
||||||
|
|
||||||
//The audio path
|
//The audio data
|
||||||
String audioPath;
|
TreeDataAudio audioData;
|
||||||
|
|
||||||
//The function to fire on completion (ie to transition to the next state)
|
//The function to fire on completion (ie to transition to the next state)
|
||||||
Runnable onComplete;
|
Runnable onComplete;
|
||||||
@ -209,150 +204,93 @@ public class StateTransitionUtil {
|
|||||||
//Tracks whether the animation has been played or not
|
//Tracks whether the animation has been played or not
|
||||||
boolean startedAnimation = false;
|
boolean startedAnimation = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the animation to play for third person
|
||||||
|
* @return The animation's name
|
||||||
|
*/
|
||||||
|
String getThirdPersonAnimation(){
|
||||||
|
String toPlay = null;
|
||||||
|
if(thirdPersonAnimation != null){
|
||||||
|
toPlay = thirdPersonAnimation.getName();
|
||||||
|
}
|
||||||
|
if(getThirdPersonAnimation != null){
|
||||||
|
toPlay = getThirdPersonAnimation.get();
|
||||||
|
}
|
||||||
|
return toPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the animation to play for first person
|
||||||
|
* @return The animation's name
|
||||||
|
*/
|
||||||
|
String getFirstPersonAnimation(){
|
||||||
|
String toPlay = null;
|
||||||
|
if(firstPersonAnimation != null){
|
||||||
|
toPlay = firstPersonAnimation.getName();
|
||||||
|
}
|
||||||
|
if(getFirstPersonAnimation != null){
|
||||||
|
toPlay = getFirstPersonAnimation.get();
|
||||||
|
}
|
||||||
|
return toPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the animation priority
|
||||||
|
* @return The animation priority
|
||||||
|
*/
|
||||||
|
int getAnimationPriority(){
|
||||||
|
int priority = this.animPriority;
|
||||||
|
if(thirdPersonAnimation != null && thirdPersonAnimation.getPriority() != null){
|
||||||
|
priority = thirdPersonAnimation.getPriority();
|
||||||
|
}
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
private StateTransitionUtilItem(
|
private StateTransitionUtilItem(
|
||||||
Object stateEnum,
|
Object stateEnum,
|
||||||
int animPriority,
|
TreeDataAnimation firstPersonAnimation,
|
||||||
String firstPersonAnimation,
|
TreeDataAnimation thirdPersonAnimation,
|
||||||
Supplier<String> getFirstPersonAnimation,
|
TreeDataAudio audioData,
|
||||||
String thirdPersonAnimation,
|
|
||||||
Supplier<String> getThirdPersonAnimation,
|
|
||||||
String audioPath,
|
|
||||||
Runnable onComplete
|
Runnable onComplete
|
||||||
){
|
){
|
||||||
this.stateEnum = stateEnum;
|
this.stateEnum = stateEnum;
|
||||||
this.animPriority = animPriority;
|
|
||||||
this.firstPersonAnimation = firstPersonAnimation;
|
this.firstPersonAnimation = firstPersonAnimation;
|
||||||
this.getFirstPersonAnimation = getFirstPersonAnimation;
|
|
||||||
this.thirdPersonAnimation = thirdPersonAnimation;
|
this.thirdPersonAnimation = thirdPersonAnimation;
|
||||||
this.getThirdPersonAnimation = getThirdPersonAnimation;
|
this.audioData = audioData;
|
||||||
this.audioPath = audioPath;
|
|
||||||
this.onComplete = onComplete;
|
this.onComplete = onComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor for supplier type
|
||||||
* @param stateEnum The enum value for this state
|
|
||||||
* @param animPriority The priority of this state's animations
|
|
||||||
* @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person
|
|
||||||
* @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person
|
|
||||||
* @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person
|
|
||||||
* @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person
|
|
||||||
* @param audioPath The path to an audio file to play on starting the animation. If null, no audio will be played
|
|
||||||
* @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop
|
|
||||||
*/
|
*/
|
||||||
public static StateTransitionUtilItem create(
|
private StateTransitionUtilItem(
|
||||||
Object stateEnum,
|
Object stateEnum,
|
||||||
int animPriority,
|
int animPriority,
|
||||||
String firstPersonAnimation,
|
|
||||||
Supplier<String> getFirstPersonAnimation,
|
Supplier<String> getFirstPersonAnimation,
|
||||||
String thirdPersonAnimation,
|
|
||||||
Supplier<String> getThirdPersonAnimation,
|
Supplier<String> getThirdPersonAnimation,
|
||||||
String audioPath,
|
TreeDataAudio audioData,
|
||||||
Runnable onComplete
|
Runnable onComplete
|
||||||
){
|
){
|
||||||
return new StateTransitionUtilItem(
|
this.stateEnum = stateEnum;
|
||||||
stateEnum,
|
this.animPriority = animPriority;
|
||||||
animPriority,
|
this.getFirstPersonAnimation = getFirstPersonAnimation;
|
||||||
firstPersonAnimation,
|
this.getThirdPersonAnimation = getThirdPersonAnimation;
|
||||||
getFirstPersonAnimation,
|
this.audioData = audioData;
|
||||||
thirdPersonAnimation,
|
this.onComplete = onComplete;
|
||||||
getThirdPersonAnimation,
|
|
||||||
audioPath,
|
|
||||||
onComplete
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor for a supplier-based approach. This takes suppliers that will provide animation data on demand.
|
||||||
* @param stateEnum The enum value for this state
|
* This decouples the animations from the initialization of the tree.
|
||||||
* @param animPriority The priority of this state's animations
|
* The intended usecase is if the animation could change based on some state in the tree.
|
||||||
* @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person
|
|
||||||
* @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person
|
|
||||||
* @param audioPath The path to an audio file to play on starting the animation. If null, no audio will be played
|
|
||||||
* @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop
|
|
||||||
*/
|
|
||||||
public static StateTransitionUtilItem create(
|
|
||||||
Object stateEnum,
|
|
||||||
int animPriority,
|
|
||||||
String firstPersonAnimation,
|
|
||||||
String thirdPersonAnimation,
|
|
||||||
String audioPath,
|
|
||||||
Runnable onComplete
|
|
||||||
){
|
|
||||||
return create(
|
|
||||||
stateEnum,
|
|
||||||
animPriority,
|
|
||||||
firstPersonAnimation,
|
|
||||||
null,
|
|
||||||
thirdPersonAnimation,
|
|
||||||
null,
|
|
||||||
audioPath,
|
|
||||||
onComplete
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param stateEnum The enum value for this state
|
|
||||||
* @param animPriority The priority of this state's animations
|
|
||||||
* @param firstPersonAnimation The animation to play in first person. If this is null, it will not play any animation in first person
|
|
||||||
* @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person
|
|
||||||
* @param audioPath The path to an audio file to play on starting the animation. If null, no audio will be played
|
|
||||||
*/
|
|
||||||
public static StateTransitionUtilItem create(
|
|
||||||
Object stateEnum,
|
|
||||||
int animPriority,
|
|
||||||
String firstPersonAnimation,
|
|
||||||
String thirdPersonAnimation,
|
|
||||||
String audioPath
|
|
||||||
){
|
|
||||||
return create(
|
|
||||||
stateEnum,
|
|
||||||
animPriority,
|
|
||||||
firstPersonAnimation,
|
|
||||||
null,
|
|
||||||
thirdPersonAnimation,
|
|
||||||
null,
|
|
||||||
audioPath,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param stateEnum The enum value for this state
|
|
||||||
* @param animPriority The priority of this state's animations
|
|
||||||
* @param thirdPersonAnimation The animation to play in third person. If this is null, it will not play any animation in third person
|
|
||||||
* @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop
|
|
||||||
*/
|
|
||||||
public static StateTransitionUtilItem create(
|
|
||||||
Object stateEnum,
|
|
||||||
int animPriority,
|
|
||||||
String thirdPersonAnimation,
|
|
||||||
Runnable onComplete
|
|
||||||
){
|
|
||||||
return create(
|
|
||||||
stateEnum,
|
|
||||||
animPriority,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
thirdPersonAnimation,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
onComplete
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param stateEnum The enum value for this state
|
* @param stateEnum The enum value for this state
|
||||||
* @param animPriority The priority of this state's animations
|
* @param animPriority The priority of this state's animations
|
||||||
* @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person
|
* @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person
|
||||||
* @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person
|
* @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person
|
||||||
* @param audioPath The path to an audio file to play on starting the animation. If null, no audio will be played
|
* @param audioData The path to an audio file to play on starting the animation. If null, no audio will be played
|
||||||
* @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop
|
* @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop
|
||||||
*/
|
*/
|
||||||
public static StateTransitionUtilItem create(
|
public static StateTransitionUtilItem create(
|
||||||
@ -360,119 +298,41 @@ public class StateTransitionUtil {
|
|||||||
int animPriority,
|
int animPriority,
|
||||||
Supplier<String> getFirstPersonAnimation,
|
Supplier<String> getFirstPersonAnimation,
|
||||||
Supplier<String> getThirdPersonAnimation,
|
Supplier<String> getThirdPersonAnimation,
|
||||||
String audioPath,
|
TreeDataAudio audioData,
|
||||||
Runnable onComplete
|
Runnable onComplete
|
||||||
){
|
){
|
||||||
return new StateTransitionUtilItem(
|
return new StateTransitionUtilItem(
|
||||||
stateEnum,
|
stateEnum,
|
||||||
animPriority,
|
animPriority,
|
||||||
null,
|
|
||||||
getFirstPersonAnimation,
|
getFirstPersonAnimation,
|
||||||
null,
|
|
||||||
getThirdPersonAnimation,
|
getThirdPersonAnimation,
|
||||||
audioPath,
|
audioData,
|
||||||
onComplete
|
onComplete
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Creates a state transition based on tree data for the state
|
||||||
* @param stateEnum The enum value for this state
|
* @param stateEnum The enum value for this state in particular in the tree
|
||||||
* @param animPriority The priority of this state's animations
|
* @param treeData The tree data for this state
|
||||||
* @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person
|
* @return The item for the transition util
|
||||||
* @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person
|
|
||||||
* @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop
|
|
||||||
*/
|
*/
|
||||||
public static StateTransitionUtilItem create(
|
public static StateTransitionUtilItem create(
|
||||||
Object stateEnum,
|
Object stateEnum,
|
||||||
int animPriority,
|
TreeDataState treeData,
|
||||||
Supplier<String> getFirstPersonAnimation,
|
|
||||||
Supplier<String> getThirdPersonAnimation,
|
|
||||||
Runnable onComplete
|
Runnable onComplete
|
||||||
){
|
){
|
||||||
return new StateTransitionUtilItem(
|
StateTransitionUtilItem rVal = null;
|
||||||
stateEnum,
|
if(treeData != null){
|
||||||
animPriority,
|
rVal = new StateTransitionUtilItem(
|
||||||
null,
|
stateEnum,
|
||||||
getFirstPersonAnimation,
|
treeData.getFirstPersonAnimation(),
|
||||||
null,
|
treeData.getThirdPersonAnimation(),
|
||||||
getThirdPersonAnimation,
|
treeData.getAudioData(),
|
||||||
null,
|
onComplete
|
||||||
onComplete
|
);
|
||||||
);
|
}
|
||||||
}
|
return rVal;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param stateEnum The enum value for this state
|
|
||||||
* @param animPriority The priority of this state's animations
|
|
||||||
* @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person
|
|
||||||
* @param onComplete !!Must transition to the next state!! Fires when the animation completes. If not supplied, animations and autio will loop
|
|
||||||
*/
|
|
||||||
public static StateTransitionUtilItem create(
|
|
||||||
Object stateEnum,
|
|
||||||
int animPriority,
|
|
||||||
Supplier<String> getThirdPersonAnimation,
|
|
||||||
Runnable onComplete
|
|
||||||
){
|
|
||||||
return new StateTransitionUtilItem(
|
|
||||||
stateEnum,
|
|
||||||
animPriority,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
getThirdPersonAnimation,
|
|
||||||
null,
|
|
||||||
onComplete
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param stateEnum The enum value for this state
|
|
||||||
* @param animPriority The priority of this state's animations
|
|
||||||
* @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person
|
|
||||||
*/
|
|
||||||
public static StateTransitionUtilItem create(
|
|
||||||
Object stateEnum,
|
|
||||||
int animPriority,
|
|
||||||
Supplier<String> getThirdPersonAnimation
|
|
||||||
){
|
|
||||||
return new StateTransitionUtilItem(
|
|
||||||
stateEnum,
|
|
||||||
animPriority,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
getThirdPersonAnimation,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param stateEnum The enum value for this state
|
|
||||||
* @param animPriority The priority of this state's animations
|
|
||||||
* @param getFirstPersonAnimation The supplier for a first person animation name. If it is null, it will not play any animation in first person
|
|
||||||
* @param getThirdPersonAnimation The supplier for a third person animation name. If it is null, it will not play any animation in the third person
|
|
||||||
*/
|
|
||||||
public static StateTransitionUtilItem create(
|
|
||||||
Object stateEnum,
|
|
||||||
int animPriority,
|
|
||||||
Supplier<String> getFirstPersonAnimation,
|
|
||||||
Supplier<String> getThirdPersonAnimation
|
|
||||||
){
|
|
||||||
return new StateTransitionUtilItem(
|
|
||||||
stateEnum,
|
|
||||||
animPriority,
|
|
||||||
null,
|
|
||||||
getFirstPersonAnimation,
|
|
||||||
null,
|
|
||||||
getThirdPersonAnimation,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -42,4 +42,10 @@ public class AnimationPriorities {
|
|||||||
//
|
//
|
||||||
public static final int IDLE = 10;
|
public static final int IDLE = 10;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
//50
|
||||||
|
//
|
||||||
|
public static final int DEFAULT = 50;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,19 +58,25 @@ public class ClientBlockTree implements BehaviorTree {
|
|||||||
BlockState.WIND_UP,
|
BlockState.WIND_UP,
|
||||||
AnimationPriorities.BLOCK,
|
AnimationPriorities.BLOCK,
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpFirstPersonAnimation();},
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpFirstPersonAnimation();},
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();}
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();},
|
||||||
|
null,
|
||||||
|
null
|
||||||
),
|
),
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
BlockState.BLOCKING,
|
BlockState.BLOCKING,
|
||||||
AnimationPriorities.BLOCK,
|
AnimationPriorities.BLOCK,
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainFirstPersonAnimation();},
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainFirstPersonAnimation();},
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();}
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();},
|
||||||
|
null,
|
||||||
|
null
|
||||||
),
|
),
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
BlockState.COOLDOWN,
|
BlockState.COOLDOWN,
|
||||||
AnimationPriorities.BLOCK,
|
AnimationPriorities.BLOCK,
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownFirstPersonAnimation();},
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownFirstPersonAnimation();},
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();}
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();},
|
||||||
|
null,
|
||||||
|
null
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,18 +51,25 @@ public class ServerBlockTree implements BehaviorTree {
|
|||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
BlockState.WIND_UP,
|
BlockState.WIND_UP,
|
||||||
AnimationPriorities.BLOCK,
|
AnimationPriorities.BLOCK,
|
||||||
|
null,
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();},
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();},
|
||||||
|
null,
|
||||||
() -> {this.setState(BlockState.BLOCKING);}
|
() -> {this.setState(BlockState.BLOCKING);}
|
||||||
),
|
),
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
BlockState.BLOCKING,
|
BlockState.BLOCKING,
|
||||||
AnimationPriorities.BLOCK,
|
AnimationPriorities.BLOCK,
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();}
|
null,
|
||||||
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();},
|
||||||
|
null,
|
||||||
|
null
|
||||||
),
|
),
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
BlockState.COOLDOWN,
|
BlockState.COOLDOWN,
|
||||||
AnimationPriorities.BLOCK,
|
AnimationPriorities.BLOCK,
|
||||||
|
null,
|
||||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();},
|
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();},
|
||||||
|
null,
|
||||||
() -> {this.setState(BlockState.NOT_BLOCKING);}
|
() -> {this.setState(BlockState.NOT_BLOCKING);}
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import electrosphere.net.synchronization.BehaviorTreeIdEnums;
|
|||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
import electrosphere.entity.btree.StateTransitionUtil;
|
import electrosphere.entity.btree.StateTransitionUtil;
|
||||||
import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem;
|
import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem;
|
||||||
import electrosphere.entity.state.AnimationPriorities;
|
|
||||||
import electrosphere.game.data.creature.type.HealthSystem;
|
import electrosphere.game.data.creature.type.HealthSystem;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
@ -120,10 +119,8 @@ public class ClientLifeTree implements BehaviorTree {
|
|||||||
stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{
|
stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
LifeStateEnum.DYING,
|
LifeStateEnum.DYING,
|
||||||
AnimationPriorities.DEATH,
|
healthSystem.getDyingState(),
|
||||||
healthSystem.getDyingFirstPersonAnimation(),
|
() -> {}
|
||||||
healthSystem.getDyingThirdPersonAnimation(),
|
|
||||||
healthSystem.getAudioPath()
|
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import electrosphere.net.parser.net.message.SynchronizationMessage;
|
|||||||
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.state.AnimationPriorities;
|
|
||||||
import electrosphere.entity.state.life.ClientLifeTree.LifeStateEnum;
|
import electrosphere.entity.state.life.ClientLifeTree.LifeStateEnum;
|
||||||
import electrosphere.game.data.creature.type.HealthSystem;
|
import electrosphere.game.data.creature.type.HealthSystem;
|
||||||
import electrosphere.net.synchronization.annotation.SyncedField;
|
import electrosphere.net.synchronization.annotation.SyncedField;
|
||||||
@ -177,8 +176,7 @@ public class ServerLifeTree implements BehaviorTree {
|
|||||||
stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{
|
stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
LifeStateEnum.DYING,
|
LifeStateEnum.DYING,
|
||||||
AnimationPriorities.DEATH,
|
this.healthSystem.getDyingState(),
|
||||||
this.healthSystem.getDyingThirdPersonAnimation(),
|
|
||||||
() -> {
|
() -> {
|
||||||
this.setState(LifeStateEnum.DEAD);
|
this.setState(LifeStateEnum.DEAD);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import electrosphere.entity.Entity;
|
|||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
|
import electrosphere.entity.btree.StateTransitionUtil;
|
||||||
|
import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem;
|
||||||
import electrosphere.entity.state.AnimationPriorities;
|
import electrosphere.entity.state.AnimationPriorities;
|
||||||
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
|
||||||
import electrosphere.game.data.creature.type.movement.FallMovementSystem;
|
import electrosphere.game.data.creature.type.movement.FallMovementSystem;
|
||||||
@ -35,26 +37,30 @@ public class FallTree implements BehaviorTree {
|
|||||||
//the related jump tree
|
//the related jump tree
|
||||||
JumpTree jumpTree;
|
JumpTree jumpTree;
|
||||||
|
|
||||||
|
//The state transition util
|
||||||
|
StateTransitionUtil stateTransitionUtil;
|
||||||
|
|
||||||
public FallTree(Entity parent, FallMovementSystem fallMovementSystem){
|
public FallTree(Entity parent, FallMovementSystem fallMovementSystem){
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.fallMovementSystem = fallMovementSystem;
|
this.fallMovementSystem = fallMovementSystem;
|
||||||
|
stateTransitionUtil = StateTransitionUtil.create(
|
||||||
|
parent,
|
||||||
|
false,
|
||||||
|
new StateTransitionUtilItem[]{
|
||||||
|
StateTransitionUtilItem.create(
|
||||||
|
FallState.ACTIVE,
|
||||||
|
fallMovementSystem.getFallState(),
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void simulate(float deltaTime) {
|
public void simulate(float deltaTime) {
|
||||||
Actor entityActor = EntityUtils.getActor(parent);
|
|
||||||
switch(state){
|
switch(state){
|
||||||
case ACTIVE:
|
case ACTIVE:
|
||||||
if(entityActor != null){
|
stateTransitionUtil.simulate(FallState.ACTIVE);
|
||||||
if(
|
|
||||||
!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(fallMovementSystem.getAnimationFall().getName()) &&
|
|
||||||
(jumpTree == null || !jumpTree.isJumping())
|
|
||||||
){
|
|
||||||
entityActor.playAnimation(fallMovementSystem.getAnimationFall().getName(),AnimationPriorities.FALL);
|
|
||||||
entityActor.incrementAnimationTime(0.0001);
|
|
||||||
}
|
|
||||||
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getAnimationFirstPersonFall().getName(), AnimationPriorities.FALL);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case INACTIVE:
|
case INACTIVE:
|
||||||
break;
|
break;
|
||||||
@ -85,12 +91,12 @@ public class FallTree implements BehaviorTree {
|
|||||||
Actor entityActor = EntityUtils.getActor(parent);
|
Actor entityActor = EntityUtils.getActor(parent);
|
||||||
if(entityActor != null){
|
if(entityActor != null){
|
||||||
if(
|
if(
|
||||||
!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(fallMovementSystem.getAnimationLand().getName())
|
!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(fallMovementSystem.getLandState().getThirdPersonAnimation().getName())
|
||||||
){
|
){
|
||||||
entityActor.playAnimation(fallMovementSystem.getAnimationLand().getName(),AnimationPriorities.LAND);
|
entityActor.playAnimation(fallMovementSystem.getLandState().getThirdPersonAnimation().getName(),AnimationPriorities.LAND);
|
||||||
entityActor.incrementAnimationTime(0.0001);
|
entityActor.incrementAnimationTime(0.0001);
|
||||||
}
|
}
|
||||||
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getAnimationFirstPersonLand().getName(), AnimationPriorities.LAND);
|
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getLandState().getFirstPersonAnimation().getName(), AnimationPriorities.LAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import electrosphere.entity.EntityDataStrings;
|
|||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
import electrosphere.entity.state.AnimationPriorities;
|
import electrosphere.entity.state.AnimationPriorities;
|
||||||
|
import electrosphere.game.data.creature.type.movement.FallMovementSystem;
|
||||||
import electrosphere.server.poseactor.PoseActor;
|
import electrosphere.server.poseactor.PoseActor;
|
||||||
|
|
||||||
public class ServerFallTree implements BehaviorTree {
|
public class ServerFallTree implements BehaviorTree {
|
||||||
@ -23,7 +24,7 @@ public class ServerFallTree implements BehaviorTree {
|
|||||||
|
|
||||||
ServerJumpTree jumpTree;
|
ServerJumpTree jumpTree;
|
||||||
|
|
||||||
public ServerFallTree(Entity parent){
|
public ServerFallTree(Entity parent, FallMovementSystem fallMovementSystem){
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package electrosphere.entity.state.movement.groundmove;
|
package electrosphere.entity.state.movement.groundmove;
|
||||||
|
|
||||||
|
|
||||||
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
|
||||||
import electrosphere.net.synchronization.FieldIdEnums;
|
import electrosphere.net.synchronization.FieldIdEnums;
|
||||||
|
|
||||||
import electrosphere.net.parser.net.message.SynchronizationMessage;
|
import electrosphere.net.parser.net.message.SynchronizationMessage;
|
||||||
|
|||||||
@ -474,13 +474,7 @@ public class CreatureUtils {
|
|||||||
// Falling
|
// Falling
|
||||||
case FallMovementSystem.FALL_MOVEMENT_SYSTEM:
|
case FallMovementSystem.FALL_MOVEMENT_SYSTEM:
|
||||||
FallMovementSystem fallMovementSystem = (FallMovementSystem)movementSystem;
|
FallMovementSystem fallMovementSystem = (FallMovementSystem)movementSystem;
|
||||||
ServerFallTree fallTree = new ServerFallTree(rVal);
|
ServerFallTree fallTree = new ServerFallTree(rVal,fallMovementSystem);
|
||||||
if(fallMovementSystem.getAnimationFall()!=null){
|
|
||||||
fallTree.setAnimationFall(fallMovementSystem.getAnimationFall().getName());
|
|
||||||
}
|
|
||||||
if(fallMovementSystem.getAnimationLand()!=null){
|
|
||||||
fallTree.setAnimationLand(fallMovementSystem.getAnimationLand().getName());
|
|
||||||
}
|
|
||||||
if(CreatureUtils.serverGetEntityMovementTree(rVal) != null && CreatureUtils.serverGetEntityMovementTree(rVal) instanceof ClientGroundMovementTree){
|
if(CreatureUtils.serverGetEntityMovementTree(rVal) != null && CreatureUtils.serverGetEntityMovementTree(rVal) instanceof ClientGroundMovementTree){
|
||||||
((ServerGroundMovementTree)CreatureUtils.serverGetEntityMovementTree(rVal)).setServerFallTree(fallTree);
|
((ServerGroundMovementTree)CreatureUtils.serverGetEntityMovementTree(rVal)).setServerFallTree(fallTree);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,60 @@
|
|||||||
|
package electrosphere.game.data.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data about an animation
|
||||||
|
*/
|
||||||
|
public class TreeDataAnimation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the animation if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The length of the animation in frames if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
int length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If boolean, should loop if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
boolean loops;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The priority for this animation in particular
|
||||||
|
*/
|
||||||
|
Integer priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name of the animation
|
||||||
|
* @return The name of the animation
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the length of the animation in frames
|
||||||
|
* @return The length in number of frames
|
||||||
|
*/
|
||||||
|
public int getLength() {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether the animation loops or not
|
||||||
|
* @return true if loops, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isLoops() {
|
||||||
|
return loops;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the priority for this animation
|
||||||
|
* @return The priority
|
||||||
|
*/
|
||||||
|
public Integer getPriority(){
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package electrosphere.game.data.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audio data to use when running a given tree state
|
||||||
|
*/
|
||||||
|
public class TreeDataAudio {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the audio file to play if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
String audioPath;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the audio path
|
||||||
|
*/
|
||||||
|
public String getAudioPath(){
|
||||||
|
return audioPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package electrosphere.game.data.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple tree state
|
||||||
|
*/
|
||||||
|
public class TreeDataState {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation to play for the tree's state when in first person
|
||||||
|
*/
|
||||||
|
TreeDataAnimation firstPersonAnimation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation to play for the tree's state when in third person
|
||||||
|
*/
|
||||||
|
TreeDataAnimation thirdPersonAnimation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The audio to play when running this state of the tree
|
||||||
|
*/
|
||||||
|
TreeDataAudio audioData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the first person animation data
|
||||||
|
* @return The first person animation data if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
public TreeDataAnimation getFirstPersonAnimation(){
|
||||||
|
return firstPersonAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the third person animation data
|
||||||
|
* @return The third person animation data if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
public TreeDataAnimation getThirdPersonAnimation(){
|
||||||
|
return thirdPersonAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the audio data
|
||||||
|
* @return The audio data if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
public TreeDataAudio getAudioData(){
|
||||||
|
return audioData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package electrosphere.game.data.creature.type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Data about an animation
|
|
||||||
*/
|
|
||||||
public class Animation {
|
|
||||||
|
|
||||||
String name;
|
|
||||||
int length;
|
|
||||||
boolean loops;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLength() {
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLoops() {
|
|
||||||
return loops;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -6,6 +6,7 @@ import electrosphere.game.data.creature.type.ai.AITreeData;
|
|||||||
import electrosphere.game.data.creature.type.attack.AttackMove;
|
import electrosphere.game.data.creature.type.attack.AttackMove;
|
||||||
import electrosphere.game.data.creature.type.attack.AttackMoveResolver;
|
import electrosphere.game.data.creature.type.attack.AttackMoveResolver;
|
||||||
import electrosphere.game.data.creature.type.block.BlockSystem;
|
import electrosphere.game.data.creature.type.block.BlockSystem;
|
||||||
|
import electrosphere.game.data.creature.type.bonegroups.BoneGroup;
|
||||||
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
||||||
import electrosphere.game.data.creature.type.movement.MovementSystem;
|
import electrosphere.game.data.creature.type.movement.MovementSystem;
|
||||||
import electrosphere.game.data.creature.type.rotator.RotatorSystem;
|
import electrosphere.game.data.creature.type.rotator.RotatorSystem;
|
||||||
@ -103,6 +104,11 @@ public class CreatureType {
|
|||||||
*/
|
*/
|
||||||
AttackMoveResolver attackMoveResolver;
|
AttackMoveResolver attackMoveResolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of bone groups for this creature
|
||||||
|
*/
|
||||||
|
List<BoneGroup> boneGroups;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id for this creature type
|
* Gets the id for this creature type
|
||||||
* @return The id
|
* @return The id
|
||||||
@ -246,6 +252,14 @@ public class CreatureType {
|
|||||||
public List<AITreeData> getAITrees(){
|
public List<AITreeData> getAITrees(){
|
||||||
return aiTrees;
|
return aiTrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list of bone groups for this creature
|
||||||
|
* @return The list of bone groups
|
||||||
|
*/
|
||||||
|
public List<BoneGroup> getBoneGroups(){
|
||||||
|
return boneGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package electrosphere.game.data.creature.type;
|
package electrosphere.game.data.creature.type;
|
||||||
|
|
||||||
|
import electrosphere.game.data.common.TreeDataState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data about the health of a creature
|
* Data about the health of a creature
|
||||||
*/
|
*/
|
||||||
@ -11,14 +13,10 @@ public class HealthSystem {
|
|||||||
//the number of iframes on taking damage
|
//the number of iframes on taking damage
|
||||||
int onDamageIFrames;
|
int onDamageIFrames;
|
||||||
|
|
||||||
//the third person animation to play when the entity is dying
|
/**
|
||||||
String dyingThirdPersonAnimation;
|
* The dying state
|
||||||
|
*/
|
||||||
//the first person animation to play when the entity is dying
|
TreeDataState dyingState;
|
||||||
String dyingFirstPersonAnimation;
|
|
||||||
|
|
||||||
//The audio file to play when the entity dies
|
|
||||||
String audioPath;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum health
|
* Gets the maximum health
|
||||||
@ -37,27 +35,11 @@ public class HealthSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the animation to play in third person when the entity is dying
|
* Gets the dying state data
|
||||||
* @return The animation
|
* @return The dying state data
|
||||||
*/
|
*/
|
||||||
public String getDyingThirdPersonAnimation(){
|
public TreeDataState getDyingState(){
|
||||||
return dyingThirdPersonAnimation;
|
return dyingState;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the animation to play in first person when the entity is dying
|
|
||||||
* @return The animation
|
|
||||||
*/
|
|
||||||
public String getDyingFirstPersonAnimation(){
|
|
||||||
return dyingFirstPersonAnimation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the audio path to play when the entity is dying
|
|
||||||
* @return The audio path
|
|
||||||
*/
|
|
||||||
public String getAudioPath(){
|
|
||||||
return audioPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,8 +49,7 @@ public class HealthSystem {
|
|||||||
HealthSystem rVal = new HealthSystem();
|
HealthSystem rVal = new HealthSystem();
|
||||||
rVal.maxHealth = maxHealth;
|
rVal.maxHealth = maxHealth;
|
||||||
rVal.onDamageIFrames = onDamageIFrames;
|
rVal.onDamageIFrames = onDamageIFrames;
|
||||||
rVal.dyingThirdPersonAnimation = dyingThirdPersonAnimation;
|
rVal.dyingState = dyingState;
|
||||||
rVal.dyingFirstPersonAnimation = dyingFirstPersonAnimation;
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,24 +1,26 @@
|
|||||||
package electrosphere.game.data.creature.type;
|
package electrosphere.game.data.creature.type;
|
||||||
|
|
||||||
|
import electrosphere.game.data.common.TreeDataAnimation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sprint data
|
* Sprint data
|
||||||
*/
|
*/
|
||||||
public class SprintSystem {
|
public class SprintSystem {
|
||||||
Animation animationStartUp;
|
TreeDataAnimation animationStartUp;
|
||||||
Animation animationMain;
|
TreeDataAnimation animationMain;
|
||||||
Animation animationWindDown;
|
TreeDataAnimation animationWindDown;
|
||||||
float maxVelocity;
|
float maxVelocity;
|
||||||
int staminaMax;
|
int staminaMax;
|
||||||
|
|
||||||
public Animation getAnimationStartUp() {
|
public TreeDataAnimation getAnimationStartUp() {
|
||||||
return animationStartUp;
|
return animationStartUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Animation getAnimationMain() {
|
public TreeDataAnimation getAnimationMain() {
|
||||||
return animationMain;
|
return animationMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Animation getAnimationWindDown() {
|
public TreeDataAnimation getAnimationWindDown() {
|
||||||
return animationWindDown;
|
return animationWindDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package electrosphere.game.data.creature.type.attack;
|
package electrosphere.game.data.creature.type.attack;
|
||||||
|
|
||||||
import electrosphere.game.data.creature.type.Animation;
|
import electrosphere.game.data.common.TreeDataAnimation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data about a single attack move this creature is capable of
|
* Data about a single attack move this creature is capable of
|
||||||
@ -20,9 +20,9 @@ public class AttackMove {
|
|||||||
String holdAnimationName;
|
String holdAnimationName;
|
||||||
String attackAnimationName;
|
String attackAnimationName;
|
||||||
|
|
||||||
Animation animationFirstPersonWindup;
|
TreeDataAnimation animationFirstPersonWindup;
|
||||||
Animation animationFirstPersonHold;
|
TreeDataAnimation animationFirstPersonHold;
|
||||||
Animation animationFirstPersonAttack;
|
TreeDataAnimation animationFirstPersonAttack;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Damage stuff
|
Damage stuff
|
||||||
@ -92,7 +92,7 @@ public class AttackMove {
|
|||||||
* Gets the animation data for the 1st person windup
|
* Gets the animation data for the 1st person windup
|
||||||
* @return the animation data
|
* @return the animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFirstPersonWindup(){
|
public TreeDataAnimation getAnimationFirstPersonWindup(){
|
||||||
return animationFirstPersonWindup;
|
return animationFirstPersonWindup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ public class AttackMove {
|
|||||||
* Gets the animation data for the 1st person hold
|
* Gets the animation data for the 1st person hold
|
||||||
* @return the animation data
|
* @return the animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFirstPersonHold(){
|
public TreeDataAnimation getAnimationFirstPersonHold(){
|
||||||
return animationFirstPersonHold;
|
return animationFirstPersonHold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public class AttackMove {
|
|||||||
* Gets the animation data for the 1st person attack
|
* Gets the animation data for the 1st person attack
|
||||||
* @return the animation data
|
* @return the animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFirstPersonAttack(){
|
public TreeDataAnimation getAnimationFirstPersonAttack(){
|
||||||
return animationFirstPersonAttack;
|
return animationFirstPersonAttack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
package electrosphere.game.data.creature.type.bonegroups;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups of bones that can be used for functions (ie priority on animations, hitbox data macros, etc)
|
||||||
|
*/
|
||||||
|
public class BoneGroup {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id for the bone group
|
||||||
|
*/
|
||||||
|
String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of names of bones that are within this group
|
||||||
|
*/
|
||||||
|
List<String> boneNames;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the id of the bone group
|
||||||
|
* @return The bone group id
|
||||||
|
*/
|
||||||
|
public String getId(){
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list of names of bones in the group
|
||||||
|
* @return The list of names of bones
|
||||||
|
*/
|
||||||
|
public List<String> getBoneNames(){
|
||||||
|
return boneNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,54 +1,40 @@
|
|||||||
package electrosphere.game.data.creature.type.movement;
|
package electrosphere.game.data.creature.type.movement;
|
||||||
|
|
||||||
import electrosphere.game.data.creature.type.Animation;
|
import electrosphere.game.data.common.TreeDataState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data about a falling movement system
|
* Data about a falling movement system
|
||||||
*/
|
*/
|
||||||
public class FallMovementSystem implements MovementSystem {
|
public class FallMovementSystem implements MovementSystem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of this movement system type in particular
|
||||||
|
*/
|
||||||
public static final String FALL_MOVEMENT_SYSTEM = "FALL";
|
public static final String FALL_MOVEMENT_SYSTEM = "FALL";
|
||||||
|
|
||||||
|
//The type of movement syste,
|
||||||
String type;
|
String type;
|
||||||
|
|
||||||
//Fall data
|
//Falling data
|
||||||
Animation animationFall;
|
TreeDataState fallState;
|
||||||
Animation animationFirstPersonFall;
|
|
||||||
|
|
||||||
//landing data
|
//Landing data
|
||||||
Animation animationLand;
|
TreeDataState landState;
|
||||||
Animation animationFirstPersonLand;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the animation to play in 3rd person when the creature is falling
|
* Gets the fall state data
|
||||||
* @return the animation data
|
* @return The fall state data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFall(){
|
public TreeDataState getFallState(){
|
||||||
return animationFall;
|
return fallState;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the animation to play in 1st person when the creature is falling
|
* Gets the land state data
|
||||||
* @return the animation data
|
* @return The land state data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFirstPersonFall(){
|
public TreeDataState getLandState(){
|
||||||
return animationFirstPersonFall;
|
return landState;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the animation to play in 3rd person when the creature is landing
|
|
||||||
* @return the animation data
|
|
||||||
*/
|
|
||||||
public Animation getAnimationLand(){
|
|
||||||
return animationLand;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the animation to play in 1st person when the creature is landing
|
|
||||||
* @return the animation data
|
|
||||||
*/
|
|
||||||
public Animation getAnimationFirstPersonLand(){
|
|
||||||
return animationFirstPersonLand;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package electrosphere.game.data.creature.type.movement;
|
package electrosphere.game.data.creature.type.movement;
|
||||||
|
|
||||||
import electrosphere.game.data.creature.type.Animation;
|
import electrosphere.game.data.common.TreeDataAnimation;
|
||||||
import electrosphere.game.data.creature.type.SprintSystem;
|
import electrosphere.game.data.creature.type.SprintSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,16 +19,16 @@ public class GroundMovementSystem implements MovementSystem {
|
|||||||
float maxVelocity;
|
float maxVelocity;
|
||||||
|
|
||||||
//startup data
|
//startup data
|
||||||
Animation animationStartup;
|
TreeDataAnimation animationStartup;
|
||||||
Animation animationFirstPersonStartup;
|
TreeDataAnimation animationFirstPersonStartup;
|
||||||
|
|
||||||
//loop data
|
//loop data
|
||||||
Animation animationLoop;
|
TreeDataAnimation animationLoop;
|
||||||
Animation animationFirstPersonLoop;
|
TreeDataAnimation animationFirstPersonLoop;
|
||||||
|
|
||||||
//wind down data
|
//wind down data
|
||||||
Animation animationWindDown;
|
TreeDataAnimation animationWindDown;
|
||||||
Animation animationFirstPersonWindDown;
|
TreeDataAnimation animationFirstPersonWindDown;
|
||||||
|
|
||||||
//sprint data
|
//sprint data
|
||||||
SprintSystem sprintSystem;
|
SprintSystem sprintSystem;
|
||||||
@ -54,7 +54,7 @@ public class GroundMovementSystem implements MovementSystem {
|
|||||||
* Gets the animation to play in 3rd person for startup
|
* Gets the animation to play in 3rd person for startup
|
||||||
* @return The animation data
|
* @return The animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationStartup() {
|
public TreeDataAnimation getAnimationStartup() {
|
||||||
return animationStartup;
|
return animationStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class GroundMovementSystem implements MovementSystem {
|
|||||||
* Gets the animation to play in 1st person for startup
|
* Gets the animation to play in 1st person for startup
|
||||||
* @return The animation data
|
* @return The animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFirstPersonStartup(){
|
public TreeDataAnimation getAnimationFirstPersonStartup(){
|
||||||
return animationFirstPersonStartup;
|
return animationFirstPersonStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ public class GroundMovementSystem implements MovementSystem {
|
|||||||
* Gets the animation to loop in 3rd person
|
* Gets the animation to loop in 3rd person
|
||||||
* @return The animation data
|
* @return The animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationLoop() {
|
public TreeDataAnimation getAnimationLoop() {
|
||||||
return animationLoop;
|
return animationLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ public class GroundMovementSystem implements MovementSystem {
|
|||||||
* Gets the animation to loop in 1st person
|
* Gets the animation to loop in 1st person
|
||||||
* @return The animation data
|
* @return The animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFirstPersonLoop(){
|
public TreeDataAnimation getAnimationFirstPersonLoop(){
|
||||||
return animationFirstPersonLoop;
|
return animationFirstPersonLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class GroundMovementSystem implements MovementSystem {
|
|||||||
* Gets the animation to play in 3rd person to wind down
|
* Gets the animation to play in 3rd person to wind down
|
||||||
* @return The animation data
|
* @return The animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationWindDown() {
|
public TreeDataAnimation getAnimationWindDown() {
|
||||||
return animationWindDown;
|
return animationWindDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public class GroundMovementSystem implements MovementSystem {
|
|||||||
* Gets the animation to play in 1st person to wind down
|
* Gets the animation to play in 1st person to wind down
|
||||||
* @return The animation data
|
* @return The animation data
|
||||||
*/
|
*/
|
||||||
public Animation getAnimationFirstPersonWindDown(){
|
public TreeDataAnimation getAnimationFirstPersonWindDown(){
|
||||||
return animationFirstPersonWindDown;
|
return animationFirstPersonWindDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package electrosphere.game.data.creature.type.movement;
|
package electrosphere.game.data.creature.type.movement;
|
||||||
|
|
||||||
import electrosphere.game.data.creature.type.Animation;
|
import electrosphere.game.data.common.TreeDataAnimation;
|
||||||
|
|
||||||
public class JumpMovementSystem implements MovementSystem {
|
public class JumpMovementSystem implements MovementSystem {
|
||||||
|
|
||||||
@ -8,8 +8,8 @@ public class JumpMovementSystem implements MovementSystem {
|
|||||||
|
|
||||||
String type;
|
String type;
|
||||||
|
|
||||||
Animation animationJump;
|
TreeDataAnimation animationJump;
|
||||||
Animation animationFirstPersonJump;
|
TreeDataAnimation animationFirstPersonJump;
|
||||||
|
|
||||||
int jumpFrames;
|
int jumpFrames;
|
||||||
float jumpForce;
|
float jumpForce;
|
||||||
@ -22,11 +22,11 @@ public class JumpMovementSystem implements MovementSystem {
|
|||||||
return jumpForce;
|
return jumpForce;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Animation getAnimationJump(){
|
public TreeDataAnimation getAnimationJump(){
|
||||||
return animationJump;
|
return animationJump;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Animation getAnimationFirstPersonJump(){
|
public TreeDataAnimation getAnimationFirstPersonJump(){
|
||||||
return animationFirstPersonJump;
|
return animationFirstPersonJump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user