// Start is called before the first frame update
    void Start()
    {
        active         = true;
        GameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <roomManager>();
        players        = new List <GameObject>();
        GameObject[] allPlayers = GameObject.FindGameObjectsWithTag("Player");
        for (int i = 0; i < GameObject.FindGameObjectsWithTag("Player").Length; i++)
        {
            if (allPlayers[i].GetComponent <PlayerMovement>().isDummy == false)
            {
                players.Add(allPlayers[i]);
            }
        }
        //Debug.Log("Players: " + players.Length);
        donePlayers   = new List <GameObject>();
        playersInZone = new List <GameObject>();
        alivePlayers  = players.Count;

        rightEdge = transform.Find("RightEdge").gameObject;
        rightWall = rightEdge.transform.GetChild(0).GetComponentInChildren <BoxCollider>();
        leftEdge  = transform.Find("LeftEdge").gameObject;
        leftWall  = leftEdge.transform.GetChild(0).GetComponent <BoxCollider>();

        openLeft();
        sealRight();

        InvokeRepeating("checkAlivePlayers", 2.0f, 2f);
    }
Esempio n. 2
0
 void DebugGen()
 {
     for (int x = 0; x < 3; x++)
     {
         for (int y = 0; y < 3; y++)
         {
             roomManager room = Instantiate(basicRoom, new Vector3(roomOffset.x * x, roomOffset.y * y), Quaternion.identity);
             room.transform.parent = transform;
             door door = Instantiate(door_N, room.door_N_Spawn.transform);
             door.transform.parent = room.transform;
             room.doors.Add(door);
             door = Instantiate(door_W, room.door_W_Spawn.transform);
             door.transform.parent = room.transform;
             room.doors.Add(door);
             door = Instantiate(door_S, room.door_S_Spawn.transform);
             door.transform.parent = room.transform;
             room.doors.Add(door);
             door = Instantiate(door_E, room.door_E_Spawn.transform);
             door.transform.parent = room.transform;
             room.doors.Add(door);
             roomLayout layout = Instantiate(layouts[Random.Range(0, layouts.Count)], room.transform);
             room.enemies = layout.enemies;
         }
     }
 }
Esempio n. 3
0
    void CreateRoom(RoomNode node)
    {
        roomManager room = Instantiate(basicRoom, node.position, Quaternion.identity);

        room.transform.parent = transform;
        room.connections      = node.connections;
        createdRooms.Add(room);
        node.roomManager = room;
    }
Esempio n. 4
0
    public override void OnJoinedRoom()
    {
        GameObject mySpaceship = PhotonNetwork.Instantiate("Spaceship", playerPos + forwardTransform * 2, Quaternion.identity, 0);

        mySpaceship.transform.eulerAngles = shipRotation;
        mySpaceship.GetComponent <spaceShipControls>().velocity        = shipVelocity;
        mySpaceship.GetComponent <spaceShipControls>().turningVelocity = shipTurningVelocity;

        mySpaceship.GetComponent <spaceShipControls>().enabled = true;
        print("rotation: " + shipRotation);
        GameObject.Find("CameraOrbitPoint").GetComponent <cameraControls>().myShip = mySpaceship.transform;
        roommanager                = GameObject.Find("Room Manager").GetComponent <roomManager>();
        roommanager.myShip         = mySpaceship.transform;
        roommanager.networkManager = this;
        myPlayer = mySpaceship;
    }
Esempio n. 5
0
    void RpcSetPlayerName()
    {
        if (manager == null)
        {
            manager = GameObject.Find("Room Manager").GetComponent <roomManager>();
        }
        Transform playerList = GameObject.Find("Players").transform;

        for (int i = 0; i < manager.roomSlots.Count; i++)
        {
            Lobby_RoomPlayer p = manager.roomSlots[i].GetComponent <Lobby_RoomPlayer>();
            playerList.GetChild(i).gameObject.SetActive(true);
            playerList.GetChild(i).GetChild(1).gameObject.SetActive(true);
            playerList.GetChild(i).GetComponentInChildren <Button>().onClick.AddListener(readyUp);
            playerList.GetChild(i).GetComponentInChildren <Text>().text = p.playerName;
        }
    }
Esempio n. 6
0
    public void OnEndDrag(PointerEventData eventData)
    {
        gameObject.GetComponent <Image>().raycastTarget = true;
        if (item.GetItemType() == ItemType.Null)
        {
            return;
        }

        GameObject room;

        if (OnRayCastSprite(out room))
        {
            roomManager roomManager = room.GetComponent <roomManager>();
            if (roomManager != null && roomManager.lightStatus == false)
            {
                roomManager.lightOn();
                if (item.GetItemType() == ItemType.GlowStick)
                {
                    roomManager.Timer(ConstKey.GLOW_STICK_SECOND);
                }
                item.SetItemType(ItemType.Null);
                UIManager.instance.curItem--;
            }
        }
        else
        {
            GameObject go = eventData.pointerCurrentRaycast.gameObject;
            if (go != null && go.tag == ConstKey.TAG_UI_ITEM)
            {
                go.GetComponent <UIItem>().SetItemType(item.GetItemType());
                item.SetItemType(ItemType.Null);
            }
        }



        rt.position = orginPos;
    }