/// <summary> /// /// </summary> /// <param name="gameTime"></param> public override void Act(GameTime gameTime) { // Detect if the block has been moved if (Data.x != lastX || Data.y != lastY) { Action = new SequenceAction( new DelayAction(150), new MoveByAction(new Vector2(Width * (Data.x - lastX), Height * (Data.y - lastY)), 750, new BounceOut(4)) ); lastX = Data.x; lastY = Data.y; } // Detect if this block is dead if (Data.state != lastState && Data.state == CanData.CanState.DYING) { Action = new SequenceAction( new ColorAction(Color.Transparent, 500), new RemoveActorAction( )); lastState = Data.state; } base.Act(gameTime); }
/// <summary> /// Constructor /// </summary> /// <param name="data"></param> public CanActor(CanData data) { this.Data = data; lastX = this.Data.x; lastY = this.Data.y; lastState = this.Data.state; Width = 53; // TODO: Convert to constant Height = 60; // TODO: Convert to constant OriginX = Width / 2; OriginY = Height / 2; }