server plays blocking animation
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
91a84185c1
commit
92a6cefc20
Binary file not shown.
@ -159,19 +159,23 @@ public class StateTransitionUtil {
|
||||
animation = state.getAnimation.get();
|
||||
}
|
||||
|
||||
//Main simulation
|
||||
if(!poseActor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true && animation != null){
|
||||
|
||||
if(animation == null){
|
||||
state.startedAnimation = true;
|
||||
if(state.onComplete != null){
|
||||
state.onComplete.run();
|
||||
}
|
||||
} else if(!poseActor.isPlayingAnimation() && state.onComplete != null && state.startedAnimation == true){
|
||||
//state transition if this isn't set to loop
|
||||
state.onComplete.run();
|
||||
state.startedAnimation = false;
|
||||
} else if(state.animation != null && (!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animation))){
|
||||
} else if(!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animation)){
|
||||
//play animation for state
|
||||
poseActor.playAnimation(animation);
|
||||
if(animation != null){
|
||||
poseActor.playAnimation(animation);
|
||||
}
|
||||
poseActor.incrementAnimationTime(0.0001);
|
||||
state.startedAnimation = true;
|
||||
} else if(state.animation == null && state.onComplete != null){
|
||||
state.onComplete.run();
|
||||
state.startedAnimation = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,13 @@ public class ServerBlockTree implements BehaviorTree {
|
||||
this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{
|
||||
StateTransitionUtilItem.create(
|
||||
BlockState.WIND_UP,
|
||||
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();},
|
||||
() -> {
|
||||
BlockVariant variant = this.blockSystem.getBlockVariant(this.currentBlockVariant);
|
||||
if(variant != null){
|
||||
return variant.getWindUpAnimation();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
null,
|
||||
() -> {this.setState(BlockState.BLOCKING);}
|
||||
),
|
||||
|
||||
@ -101,12 +101,15 @@ public class PoseActor {
|
||||
|
||||
/**
|
||||
* Gets whether the animation is currently playing or not
|
||||
* @param animationName The animation
|
||||
* @param animationData The animation
|
||||
* @return True if the animation is playing, false otherwise
|
||||
*/
|
||||
public boolean isPlayingAnimation(TreeDataAnimation animationName){
|
||||
public boolean isPlayingAnimation(TreeDataAnimation animationData){
|
||||
if(animationData == null){
|
||||
return false;
|
||||
}
|
||||
for(ActorAnimationMask mask : animationQueue){
|
||||
if(mask.getAnimationName().contains(animationName.getNameThirdPerson())){
|
||||
if(mask.getAnimationName().contains(animationData.getNameThirdPerson())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user