should comp update animations
This commit is contained in:
parent
3b55c98dde
commit
d97cb9dccc
@ -39,7 +39,6 @@ const Stun = require('./anims/stun');
|
||||
const Triage = require('./anims/triage');
|
||||
const TriageTick = require('./anims/triage.tick');
|
||||
|
||||
const actions = require('../actions');
|
||||
const { removeTier } = require('../utils');
|
||||
|
||||
|
||||
@ -47,10 +46,16 @@ const addState = connect(
|
||||
function receiveState(state) {
|
||||
const { animTarget } = state;
|
||||
return { animTarget };
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
class ConstructAnimation extends Component {
|
||||
shouldComponentUpdate(nextProps) {
|
||||
if (nextProps.animTarget !== this.props.animTarget) return true;
|
||||
if (nextProps.construct !== this.props.construct) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
render(props) {
|
||||
const {
|
||||
animTarget,
|
||||
@ -70,7 +75,7 @@ class ConstructAnimation extends Component {
|
||||
|
||||
|
||||
// find target animation
|
||||
const chooseAnim = (animSkill) => {
|
||||
const chooseAnim = () => {
|
||||
switch (animSkill) {
|
||||
// Attack base
|
||||
case 'Attack': return <Attack direction={direction}/>;
|
||||
@ -124,7 +129,7 @@ class ConstructAnimation extends Component {
|
||||
case 'Reflect': return <Refl player={player} />;
|
||||
|
||||
default: return false;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const anim = chooseAnim(animSkill);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user