public void Update(Entity e, float deltaTime)
 {
     if (!e.hasTween)
     {
         e.AddTween(true, new List<Tween>());
         e.tween.AddTween(e.position, EaseTypes.quadOut, PositionAccessorType.Y, timeLimit)
             .From(e.position.pos.y + 3.0f)
             .To(e.position.pos.y + GameConfig.CAMERA_SPEED * timeLimit)
             .BlockClear();
     }
 }
Beispiel #2
0
 void createDummy()
 {
     dummyEntity = pool.CreateEntity()
         .AddPosition(new Vector2(-2.0f, -2.0f))
         .AddPlayer("")
         .AddCollision(CollisionTypes.Player, 10)
         .AddResource(ResourceWithColliders.Player);
     Vector2 currentPosition = dummyEntity.position.pos;
     Vector2 offset = new Vector2(3.0f, 0.0f);
     dummyEntity.AddTween(true, new System.Collections.Generic.List<Tween>());
     dummyEntity.tween.AddTween(dummyEntity.position, EaseTypes.bounceOut, PositionAccessorType.XY, 2.0f)
             .From(currentPosition.x, currentPosition.y)
             .To(currentPosition.x + offset.x, currentPosition.y + offset.y)
             .PingPong();
 }
Beispiel #3
0
    void addTween(GridFieldComponent component, Entity e)
    {
        PositionComponent position = e.position;
        Entity gridEntity = getGridEntity(component.type);
        GridComponent grid = gridEntity.grid;
        int previousX = component.x;
        int previousY = component.y;
        PositionComponent gridPosition = gridEntity.position;
        findRandomField(grid.grid, GridState.FREE, out component.x, out component.y);
        grid.grid[component.x, component.y] = GridState.BUSY;
        if (previousX != -1) {
            grid.grid[previousX, previousY] = GridState.FREE;
        }
        component.state = GridFieldState.TWEEN;

        e.AddTween(true, new List<Tween>());
        e.tween.AddTween(position, EaseTypes.quadIn, PositionAccessorType.XY, 3.0f)
            .From(position.pos.x, position.pos.y)
            .To(gridPosition.pos.x + (float)component.x * grid.fieldSize, gridPosition.pos.y - (float)component.y * grid.fieldSize)
            .SetEndCallback(onComplete);
    }
 void addTweenIfDoesntExist(Entity e)
 {
     if (!e.hasTween) {
         e.AddTween(true, new List<Tween>());
     }
 }