コード例 #1
0
    public void LoadMapElement(Vector3 isoPos, GameObject go)
    {
        Vector3Int index = EffectiveUtility.IsoPositionToIndex(isoPos);

        if (go.GetComponent <Player>() != null)
        {
            return;
        }

        GameObject instance = Instantiate(go, isoPos, Quaternion.identity, transform);

        Character entity = instance.GetComponent <Character>();

        if (entity != null)
        {
            RoomAllEntitys.Add(entity);
            entity.OwnerRoom = this;
        }

        Door door = instance.GetComponent <Door>();

        if (door != null)
        {
            RoomDoors.Add(door);
            RoomWays.Add(door.DoorType);
            door.OwnerRoom = this;
        }
    }
コード例 #2
0
        /// <summary>
        /// Converts <see cref="RoomDoorsSerialized"/> to <see cref="RoomDoors"/>.
        /// </summary>
        /// <returns/>
        public RoomDoors ToRoomDoors()
        {
            var result = new RoomDoors(Room);

            foreach (var(item, step) in Doors)
            {
                result.AddDoor(step, item);
            }

            return(result);
        }
コード例 #3
0
    private void Update()
    {
        //ici on récupère l'information des triggers pour savoir si on doit créer une map(et dans quelle direction)
        RoomDoors RD            = ActualRoom.GetComponent <RoomDoors>();
        bool      TriggerLeft   = RD.CreateLeft;
        bool      TriggerRight  = RD.CreateRight;
        bool      TriggerTop    = RD.CreateTop;
        bool      TriggerBottom = RD.CreateBottom;
        bool      TriggerCheck  = RD.CheckSpawn;

        if (TriggerLeft == true && TriggerCheck)
        {
            //Debug.Log("zou c'est le gauche");
            SpawnRoomLeft();
            ResetPlayers();
            SpawnPlayers();
            GameManager.MinimapPosX -= 1;
        }
        if (TriggerRight == true && TriggerCheck)
        {
            //Debug.Log("oho c'est le droite");
            SpawnRoomRight();
            ResetPlayers();
            SpawnPlayers();
            GameManager.MinimapPosX += 1;
        }
        if (TriggerTop == true && TriggerCheck)
        {
            //Debug.Log("oho c'est le haut");
            SpawnRoomTop();
            ResetPlayers();
            SpawnPlayers();
            GameManager.MinimapPosY += 1;
        }
        if (TriggerBottom == true && TriggerCheck)
        {
            //Debug.Log("oho c'est le droite");
            SpawnRoomBottom();
            ResetPlayers();
            SpawnPlayers();
            GameManager.MinimapPosY -= 1;
        }
        MoveCamera();
    }
コード例 #4
0
    void OpenDoorsFnc()
    {
        RoomDoors RD = MapManager.GetComponent <SpawnRooms>().ActualRoom.GetComponent <RoomDoors>();

        if (MinimapPosX != -1)
        {
            RD.LeftDoor = false;
        }
        if (MinimapPosX != 1)
        {
            RD.RightDoor = false;
        }
        if (MinimapPosY != 1)
        {
            RD.TopDoor = false;
        }
        if (MinimapPosY != -1)
        {
            RD.BottomDoor = false;
        }
        RD.CheckSpawn = true;
    }
コード例 #5
0
 void Start()
 {
     exitTag = gameObject.tag;
     RD      = gameObject.GetComponentInParent <RoomDoors>();
 }
コード例 #6
0
 /// <summary>
 /// Converts <see cref="RoomDoors"/> to <see cref="RoomDoorsSerialized"/>.
 /// </summary>
 /// <param name="doorsList"/>
 /// <returns/>
 public static RoomDoorsSerialized FromRoomDoors(RoomDoors doorsList)
 => new RoomDoorsSerialized()
 {
     Room  = doorsList.Room,
     Doors = doorsList.Select(pair => new ItemStepPair <PointSerialized>(pair.Item, pair.Step)).ToList()
 };