Beispiel #1
0
    //special cases
    public void SpawnSpeedItem(Vector3 pos, GameObject _go, GameObject _parent, SpeedRoomItemSpawner script)
    {
        if (!NetworkServer.active)
        {
            Debug.Log("SERVER NOT ACTIVE");
        }

        var go = Instantiate(_go, pos, Quaternion.identity);

        go.GetComponent <SpeedRoomItemScript>().SetSpawner(script);
        go.transform.SetParent(_parent.transform);
        NetworkServer.Spawn(go);
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        //Random.Range(1, 1);
        //wad = new ArrayList();
        Debug.Log("speed start");
        roomScript    = this.GetComponent <RoomScript>();
        spawnerScript = this.transform.GetChild(0).GetComponent <SpeedRoomItemSpawner>();

        doorInfoList.Add(new DoorInfo(roomScript.GetIsLocked(DIRECTION.LEFT), roomScript.GetHasTriggerBox(DIRECTION.LEFT), DIRECTION.LEFT));
        doorInfoList.Add(new DoorInfo(roomScript.GetIsLocked(DIRECTION.RIGHT), roomScript.GetHasTriggerBox(DIRECTION.RIGHT), DIRECTION.RIGHT));
        doorInfoList.Add(new DoorInfo(roomScript.GetIsLocked(DIRECTION.UP), roomScript.GetHasTriggerBox(DIRECTION.UP), DIRECTION.UP));
        doorInfoList.Add(new DoorInfo(roomScript.GetIsLocked(DIRECTION.DOWN), roomScript.GetHasTriggerBox(DIRECTION.DOWN), DIRECTION.DOWN));

        //doorList.Add(roomScript.GetIsLocked(DIRECTION.LEFT));
        //doorList.Add(roomScript.GetIsLocked(DIRECTION.RIGHT));
        //doorList.Add(roomScript.GetIsLocked(DIRECTION.UP));
        //doorList.Add(roomScript.GetIsLocked(DIRECTION.DOWN));

        elapsedTime = 0.0f;

        isLock         = false;
        puzzleComplete = false;
        isCompleted    = false;
        //playersList = GameObject.FindGameObjectsWithTag("Player");
        //Debug.Log("numPlayer: " + playersList.Length);
        //for (int i = 0; i < playersList.Length; i++)
        //{
        //    if (playersList[i].GetComponent<NetworkIdentity>().isLocalPlayer == true)
        //    {
        //        player = playersList[i];
        //        break;
        //    }
        //}

        player = Global.Instance.player;
        if (player.GetComponent <NetworkIdentity>().isServer)
        {
            Debug.Log("is a server");
        }

        style = new GUIStyle();

        style.alignment = TextAnchor.UpperCenter;

        content = new GUIContent();

        itemCollected = 0;
    }
Beispiel #3
0
 public void SetSpawner(SpeedRoomItemSpawner spawner)
 {
     this.spawner = spawner;
 }
Beispiel #4
0
 public void SetSpawnerScript()
 {
     spawnerScript = this.transform.GetChild(0).GetComponent <SpeedRoomItemSpawner>();
 }