public void AddEntity(DungeonEntityType entityType, int x, int y, DungeonRotation rotation)
    {
        //if (!CheckValidPosition(x, y))
        //    throw new ArgumentException("Invalid entity position in room");

        dungeon.AddEntity(entityType, roomPositionX + x, roomPositionY + y, rotation);
    }
Beispiel #2
0
    public void AddEntity(DungeonEntity entity, int x, int y, DungeonRotation rotation)
    {
        if (!CheckValidPosition(x, y))
        {
            throw new ArgumentException("Invalid entity position");
        }

        entities.Add(entity);

        entity.OnAddedToDungeon(this, new DungeonVector2(x, y), rotation, nextEntityId++);
    }
Beispiel #3
0
    public DungeonEntity AddEntity(DungeonEntityType entityType, int x, int y, DungeonRotation rotation)
    {
        DungeonEntity entity = DungeonEntityFactory.CreateEntity(entityType);

        if (entity == null)
        {
            throw new ArgumentException("Unknown entity type " + entityType);
        }

        AddEntity(entity, x, y, rotation);

        return(entity);
    }
    static public DungeonVector2 FromRotation(DungeonRotation rotation)
    {
        switch (rotation)
        {
        case DungeonRotation.North:
            return(Forward);

        case DungeonRotation.South:
            return(Back);

        case DungeonRotation.East:
            return(Right);

        case DungeonRotation.West:
            return(Left);
        }

        return(new DungeonVector2());
    }
    public Quaternion GetWorldRotation(DungeonRotation rotation)
    {
        switch (rotation)
        {
        case DungeonRotation.North:
            return(Quaternion.LookRotation(Vector3.forward));

        case DungeonRotation.South:
            return(Quaternion.LookRotation(Vector3.back));

        case DungeonRotation.East:
            return(Quaternion.LookRotation(Vector3.right));

        case DungeonRotation.West:
            return(Quaternion.LookRotation(Vector3.left));
        }

        return(Quaternion.identity);
    }
 public DungeonEventEntityRotated(DungeonEntity entity, DungeonRotation from, DungeonRotation to) : base(DungeonEventType.EntityRotated)
 {
     this.entity = entity;
     this.from   = from;
     this.to     = to;
 }
Beispiel #7
0
 static public DungeonEvent CreateEntityRotated(DungeonEntity entity, DungeonRotation from, DungeonRotation to)
 {
     return(new DungeonEventEntityRotated(entity, from, to));
 }