// Use this for initialization void Start() { currentSpeed = runSpeed; rigidBody = GetComponent <Rigidbody2D> (); character = GetComponent <SNCharacter> (); topDownPhysics = GetComponent <TopDownPhysics> (); currentAnimationState = AnimationsStates.Custom; if (rigidBody.isKinematic) { useKinematic = true; } else { useKinematic = false; } }
public Bat(Vector2 position, int spriteIndex) : base(position, new Box(position, new Vector2(8, 8)), spriteIndex) { var physics = new TopDownPhysics(baseSpeed, 0, 1f); flyingAnim = new SpriteAnimation(new P8Sprite(53), 2, animationLength / 2); chargingAnim = new SpriteAnimation(new P8Sprite(55), 1, animationLength / 2); AddComponent(physics); batStateMachine = new BatStateMachine(this); batStateMachine.Init(BatStates.Wondering); List <string> prevTags = tags; prevTags.Add("ignore_tile"); tags = prevTags; AddComponent(new FillBar(new Vector2(0, -2), 8, 0, lifeTime)); }
public Blob(Vector2 position, int spriteIndex) : base(position, new Box(position, new Vector2(7, 4), false, new Vector2(0, 4)), spriteIndex) { var physics = new TopDownPhysics(baseSpeed, baseSpeed / 2, 0.97f); AddComponent(physics); var anim = new P8TopDownAnimator(P8TopDownAnimator.AnimationMode.SIDES_ONLY); anim.RunLeft = new SpriteAnimation(new P8Sprite(7), 3, 0.3f); anim.RunRight = anim.RunLeft; anim.IdleLeft = new SpriteAnimation(new P8Sprite(7), 1, 0.3f); anim.IdleRight = anim.IdleLeft; AddComponent(anim); targetPosition = Vector2.Zero; InitState("Still"); AddComponent(new FillBar(new Vector2(0, -2), 8, 0, lifeTime)); }