public override void Init(GameState s, GameplayController c, object args) { state = s; initArgs = args == null ? null : args as AnimationInitArgs; if (initArgs == null) { initArgs = AnimationInitArgs.Default; } alRest = new AnimationLoop(initArgs.Splices[0].X, initArgs.Splices[0].Y); alRest.FrameSpeed = initArgs.Speeds[0]; alWalk = new AnimationLoop(initArgs.Splices[1].X, initArgs.Splices[1].Y); alWalk.FrameSpeed = initArgs.Speeds[1]; alMelee = new AnimationLoop(initArgs.Splices[2].X, initArgs.Splices[2].Y); alMelee.FrameSpeed = initArgs.Speeds[2]; alPrepareFire = new AnimationLoop(initArgs.Splices[3].X, initArgs.Splices[3].Y); alPrepareFire.FrameSpeed = initArgs.Speeds[3]; alFire = new AnimationLoop(initArgs.Splices[4].X, initArgs.Splices[4].Y); alFire.FrameSpeed = initArgs.Speeds[4]; alDeath = new AnimationLoop(initArgs.Splices[5].X, initArgs.Splices[5].Y); alDeath.FrameSpeed = initArgs.Speeds[5]; SetAnimation(BehaviorFSM.None); System.Threading.Interlocked.Exchange(ref isInit, 1); }
public void Start(int msSpeed, AnimationLoop loop) { this.msSpeed = msSpeed; this.loop = loop; this.cFrame = 0; this.end = false; }
void Awake() { Start(); // because instantiating an object doesn't instantly call Start but does call awake animLoop = this.gameObject.AddComponent <AnimationLoop> (); animLoop.loop = true; animLoop.frameRate = 12f; }
//---------------------------------------------------------------------- public SmoothValue( float _fStart, float _fEnd, float _fDuration, float _fDelay, AnimationLoop _loop ) { Start = _fStart; End = _fEnd; Duration = _fDuration; Delay = _fDelay; Time = 0f; Loop = _loop; }
//---------------------------------------------------------------------- public SmoothValue(float _fStart, float _fEnd, float _fDuration, float _fDelay, AnimationLoop _loop) { Start = _fStart; End = _fEnd; Duration = _fDuration; Delay = _fDelay; Time = 0f; Loop = _loop; }
public SmoothValue(float start, float end, float duration, float delay = 0f, AnimationLoop loop = AnimationLoop.NoLoop) { Start = start; End = end; Duration = duration; Delay = delay; Loop = loop; Time = 0f; }
public LerpValue(float start, float end, float duration, float delay = 0f, AnimationLoop loop = AnimationLoop.NoLoop) { Start = start; End = end; Duration = duration; Delay = delay; Time = 0f; Loop = loop; Direction = AnimationDirection.Forward; }
//---------------------------------------------------------------------- public BounceValue( float _fStart, float _fEnd, float _fDuration, int _iBounceCount, float _fDelay, AnimationLoop _loop ) { Start = _fStart; End = _fEnd; Duration = _fDuration; BounceCount = _iBounceCount; Delay = _fDelay; Time = 0f; Loop = _loop; }
//---------------------------------------------------------------------- public BounceValue(float _fStart, float _fEnd, float _fDuration, int _iBounceCount, float _fDelay, AnimationLoop _loop) { Start = _fStart; End = _fEnd; Duration = _fDuration; BounceCount = _iBounceCount; Delay = _fDelay; Time = 0f; Loop = _loop; }
//---------------------------------------------------------------------- public LerpValue(float _fStart, float _fEnd, float _fDuration, float _fDelay, AnimationLoop _loop) { Start = _fStart; End = _fEnd; Duration = _fDuration; Delay = _fDelay; Time = 0f; Loop = _loop; Direction = AnimationDirection.Forward; }
//---------------------------------------------------------------------- public LerpValue( float _fStart, float _fEnd, float _fDuration, float _fDelay, AnimationLoop _loop ) { Start = _fStart; End = _fEnd; Duration = _fDuration; Delay = _fDelay; Time = 0f; Loop = _loop; Direction = AnimationDirection.Forward; }
public BounceValue(float start, float end, float duration, int bounceCount, float delay = 0f, AnimationLoop loop = AnimationLoop.NoLoop) { Start = start; BounceRestitution = 0.5f; End = end; Duration = duration; BounceCount = bounceCount; Delay = delay; Time = 0f; Loop = loop; }
public Animation() { alRest = new AnimationLoop(0, 59); alRest.FrameSpeed = 30; alWalk = new AnimationLoop(60, 119); alWalk.FrameSpeed = 80; alCombat = new AnimationLoop(120, 149); alCombat.FrameSpeed = 30; SetAnimation(BehaviorFSM.None); }
public void ChangeAnimationAndStart(TextureAnimation animation, int msSpeed, AnimationLoop loop, TextureAnimation transition) { if (this.animation != animation && minTime <= 0) { this.transition = transition; this.animation = animation; this.current = transition; this.minTime = 0; Start(msSpeed, loop); Console.WriteLine("Anim: " + animation.GetHashCode()); } }
public override void Update(GameState s, float dt) { if (lastState != unit.State) { // A New Animation State If Provided SetAnimation(unit.State); if (lastState == BehaviorFSM.None) { rt = r.Next(120, 350) / 10f; } } // Save Last State lastState = unit.State; // Step The Current Animation if (alCurrent != null) { alCurrent.Step(dt); AnimationFrame = alCurrent.CurrentFrame; } if (lastState == BehaviorFSM.None) { // Check For A Random Animation if (alCurrent == null) { rt -= dt; if (rt <= 0) { rt = r.Next(120, 350) / 10f; alCurrent = alRest; alCurrent.Restart(false); } } else { // Check If At The End Of The Loop if (AnimationFrame == alCurrent.EndFrame) { alCurrent = null; rt = r.Next(120, 350) / 10f; } } } }
void Start() { ownTransform = this.transform; gameController = GameObject.FindGameObjectWithTag("GameController"); movementGrid = (Grid)gameController.GetComponent <Grid> (); if (movementGrid.getPosition(x, y) != null) { stepObject = movementGrid.getPosition(x, y).stepOn; } if (stepObject != null) { WorldInteraction stepObjectWorldInteraction = stepObject.GetComponent <WorldInteraction> (); stepObjectWorldInteraction.interact(); stepObjectWorldInteraction = null; } anim = this.gameObject.GetComponent <AnimationLoop> (); }
private void SetAnimation(int state) { switch (state) { case BehaviorFSM.None: alCurrent = null; AnimationFrame = 0; break; case BehaviorFSM.Walking: alCurrent = alWalk; alCurrent.Restart(true); break; case BehaviorFSM.PrepareCombatRanged: alCurrent = alPrepareFire; alCurrent.Restart(false); break; case BehaviorFSM.CombatRanged: alCurrent = alFire; alCurrent.Restart(false); break; case BehaviorFSM.CombatMelee: alCurrent = alMelee; alCurrent.Restart(true); break; case BehaviorFSM.Rest: alCurrent = alRest; alCurrent.Restart(true); break; default: alCurrent = null; return; } }
private void SetAnimation(int state) { switch (state) { case BehaviorFSM.Walking: alCurrent = alWalk; alCurrent.Restart(true); break; case BehaviorFSM.CombatMelee: alCurrent = alCombat; alCurrent.Restart(true); break; case BehaviorFSM.Rest: alCurrent = alRest; alCurrent.Restart(true); break; default: alCurrent = null; return; } }
public BounceValue(float start, float end, float duration, int bounceCount, AnimationLoop loop) : this(start, end, duration, bounceCount, 0f, loop) { }
public BlankAnimController(int s, int e, float sp) { animLoop = new AnimationLoop(s, e); animLoop.FrameSpeed = sp; }
public BounceValue(float _fStart, float _fEnd, float _fDuration, int _iBounceCount, AnimationLoop _loop) : this(_fStart, _fEnd, _fDuration, _iBounceCount, 0f, _loop) { }
public AnimationImage(Layer layer, Position pos, string filePath, int x, int y, int frameCount, int frameDelay, AnimationLoop loopType) : base(ImageType.Animation, layer, pos, filePath, x, y) { FrameCount = frameCount; FrameDelay = frameDelay; AnimationLoop = loopType; }
public override void Update(GameState s, float dt) { if (System.Threading.Interlocked.CompareExchange(ref isInit, 1, 1) == 0) { return; } if (addBlood) { Splurt(s.TotalGameTime); addBlood = false; } // Animate Death if (!unit.IsAlive) { if (AnimationFrame == alDeath.EndFrame) { return; } alDeath.Step(dt); AnimationFrame = alDeath.CurrentFrame; return; } if (lastState != unit.State) { // A New Animation State If Provided SetAnimation(unit.State); if (lastState == BehaviorFSM.None) { rt = r.Next(120, 350) / 10f; } } // Save Last State lastState = unit.State; // Step The Current Animation if (alCurrent != null) { alCurrent.Step(dt); AnimationFrame = alCurrent.CurrentFrame; } if (lastState == BehaviorFSM.None) { // Check For A Random Animation if (alCurrent == null) { rt -= dt; if (rt <= 0) { rt = r.Next(120, 350) / 10f; alCurrent = alRest; alCurrent.Restart(false); } } else { // Check If At The End Of The Loop if (AnimationFrame == alCurrent.EndFrame) { alCurrent = null; rt = r.Next(120, 350) / 10f; } } } }
public LerpValue(float start, float end, float duration, AnimationLoop loop) : this(start, end, duration, 0f, loop) { }
public LerpValue( float _fStart, float _fEnd, float _fDuration, AnimationLoop _loop ) : this(_fStart, _fEnd, _fDuration, 0f, _loop) { }
public SmoothValue(float _fStart, float _fEnd, float _fDuration, AnimationLoop _loop) : this(_fStart, _fEnd, _fDuration, 0f, _loop) { }
public BounceValue( float _fStart, float _fEnd, float _fDuration, int _iBounceCount, AnimationLoop _loop ) : this(_fStart, _fEnd, _fDuration, _iBounceCount, 0f, _loop) { }