public void UpdateAnimation() { if (this.currentGObjAni == null) { if (this.awaitingAnimations.Count > 0) { this.currentGObjAni = this.awaitingAnimations.Dequeue(); } else if (this.moveHandShakes.Count > 0) { this.moveHandShakes.Dequeue().PerformHandShake(); } } if (this.currentGObjAni != null) { if (this.currentGObjAni.Update(this.gameObject)) { this.currentGObjAni = null; } } }
protected void SetUnitAnimation(StandardUnitAnimations aniId, GameObjectAnimation ani) { this.animations[aniId] = ani; }
/* * This returns true if the animation for this GameObjectAnimation is done, false * otherwise. Slightly jank! */ public bool AnimateMotion(GameObject obj, GameObjectAnimation goa) { if(Time.time > goa.endMoving) { return true; } float time = (Time.time - goa.startedMoving)/speed + .15f; obj.transform.position = Vector3.Lerp(goa.oldPosition, goa.newPosition, time); return false; }