cancelRoute() public static method

public static cancelRoute ( Entity, entity ) : void
entity Entity,
return void
Example #1
0
 public void teleportTo(Cell c)
 {
     RoutePlanifier.cancelRoute(this.Entity);
     this.movement = Movement.createMovement(MovementType.Instant,
                                             this.Entity, this, dec, normalSprite, this.transform.position,
                                             c.transform.position, this.Entity.Position, c, null);
 }
Example #2
0
    public void removePaint(Cell cell, Skill skill, Entity entity = null)
    {
        Vector2 position = cell.Map.getCoords(cell.gameObject);
        int     contador = 0;
        float   xcentral = position.x;
        float   ycentral = position.y;

        //busqueda directa
        //Vamos a marcar todas las casillas que esten en la distancia de la habilidad
        for (float i = position.x - skill.getDistance(); i <= position.x + skill.getDistance(); i++)
        {
            //vamos aumentando el radio de casillas hasta la distancia de la habilidad
            for (float j = position.y - skill.getDistance(); j <= position.y + skill.getDistance(); j++)
            {
                Cell celdaAPintar = cell.Map.getCell(new Vector2(i, j));

                if (celdaAPintar != null)
                {
                    if (entity != null)
                    {
                        if (RoutePlanifier.planifyRoute(entity.mover, celdaAPintar))
                        {
                            int  distance = 0;
                            Cell measuring;
                            while (distance <= skill.getDistance() && (measuring = RoutePlanifier.next(entity.mover)))
                            {
                                entity.Position = measuring;
                                distance++;
                            }
                            entity.Position = cell;

                            RoutePlanifier.cancelRoute(entity.mover);

                            if (distance > skill.getDistance())
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if ((int)Mathf.Abs(Mathf.Abs(i - xcentral) + Mathf.Abs(j - ycentral)) <= skill.getDistance())
                    {
                        if (contador < oldTextures.Length && oldTextures[contador] != null)
                        {
                            celdaAPintar.Properties.faces[celdaAPintar.Properties.faces.Length - 1].TextureMapping = oldTextures[contador];
                            celdaAPintar.Properties.faces[celdaAPintar.Properties.faces.Length - 1].Texture        = oldTextures[contador].getTexture();
                            celdaAPintar.forceRefresh();
                        }
                        contador++;
                    }
                }
            }
        }
    }
Example #3
0
 public void switchDirection(Direction direction)
 {
     RoutePlanifier.cancelRoute(this.Entity);
     this.movement = createTurnMovement(direction);
 }