Пример #1
0
 void Awake()
 {
     recordGroup = GetComponent <PrizmRecordGroup>();
     bootstrap   = GetComponent <BootstrapTT> ();
     msgCanvas   = GameObject.Find("MsgCanvas");
     camera      = GameObject.Find("MainCamera").GetComponent <Camera> ();
 }
Пример #2
0
    int numberOfPlayers;                                                //is determined by userIDs that are in list

    //meteor connection code needs to be the first to run and connect to database (all further actions depend on finishing this initialization)
    void Awake()
    {
        recordGroup = GetComponent <PrizmRecordGroup> ();
        deviceID    = SystemInfo.deviceUniqueIdentifier;        //assign device UID for server
        gameManager = GetComponent <GameManager> ();
        msgCanvas   = GameObject.Find("MsgCanvas");
    }
Пример #3
0
 void Awake()
 {
     //uncomment when done
     introducePlayerSparkle = GameObject.Find("IntroducePlayer");
     recordGroup            = GetComponent <PrizmRecordGroup>();
     bootstrap         = GetComponent <BootstrapTT> ();
     msgCanvas         = GameObject.Find("MsgCanvas");
     camera            = GameObject.Find("Main Camera").GetComponent <Camera> ();
     cameraSetPosition = camera.transform.position;
     audioSource       = GetComponent <AudioSource> ();
 }
Пример #4
0
    private clientStatuses clientSyncPosition   = (clientStatuses)0;            //keeps track of position in client sync routine


    void Awake()
    {
        //obtain unique ID for device
        deviceID            = SystemInfo.deviceUniqueIdentifier;
        recordGroup         = GameObject.Find("GameManager").GetComponent <PrizmRecordGroup> ();
        gameManager         = GameObject.Find("/GameManager").GetComponent <GameManager> ();
        chooseSessionCanvas = GameObject.Find("ChooseSessionCanvas");
        playerNameCanvas    = GameObject.Find("PlayerNameCanvas");
        msgCanvas           = GameObject.Find("MsgCanvas");
        color = "red";
        playerNameCanvas.SetActive(false);              //disable "Enter Player Name" for now
    }
Пример #5
0
    private clientStatuses clientSyncPosition   = (clientStatuses)0;            //keeps track of position in client sync routine


    void Awake()
    {
        //obtain unique ID for device
        deviceID            = SystemInfo.deviceUniqueIdentifier;
        recordGroup         = GameObject.Find("HH_GameManager").GetComponent <PrizmRecordGroup> ();
        gameManager         = GameObject.Find("HH_GameManager").GetComponent <GameManager_HH> ();
        chooseSessionCanvas = GameObject.Find("ChooseSessionCanvas");
        playerNameCanvas    = GameObject.Find("PlayerNameCanvas");
        msgCanvas           = GameObject.Find("MsgCanvas");
        color = (PlayerColor.color)(Random.Range(0, System.Enum.GetValues(typeof(PlayerColor.color)).Length - 1));
        playerNameCanvas.SetActive(false);              //disable "Enter Player Name" for now
    }
Пример #6
0
 void Awake()
 {
     recordGroup = GameObject.Find("GameManager").GetComponent <PrizmRecordGroup> ();
     clientInit  = GameObject.Find("GameManager").GetComponent <ClientInitialization> ();
     gameManager = GameObject.Find("GameManager").GetComponent <GameManager> ();
 }
 void Awake()
 {
     recordGroup = GameObject.Find ("GameManager").GetComponent<PrizmRecordGroup> ();
     clientInit = GameObject.Find ("GameManager").GetComponent<ClientInitialization> ();
     gameManager = GameObject.Find ("GameManager").GetComponent<GameManager> ();
 }
 //set all variables
 void Awake()
 {
     recordGroup = GameObject.Find ("HH_GameManager").GetComponent<PrizmRecordGroup> ();
     clientInit = GameObject.Find ("HH_GameManager").GetComponent<ClientInitialization> ();
     bootstrap = GameObject.Find ("HH_GameManager").GetComponent<BootstrapHH> ();
 }
Пример #9
0
    //also probably read from a config.json file... u no wot? everything is json. there, i said it. everything is json here
    public IEnumerator ConfigureUpgradesDatabase()
    {
        Debug.Log("Creating upgrades into database...");
        //GameManager.Instance.GameStateReporter.text = "Game is creating DB records and\ndistributing all starting items to PLAYERS";

        upgradeRecordGroup = new PrizmRecordGroup <UpgradeSchema> (sessionID, "upgrades");

        yield return(StartCoroutine(upgradeRecordGroup.CreateMeteorCollection()));

        upgradeRecordGroup.mongoCollection.DidAddRecord += (string arg1, UpgradeSchema arg2) => {
            Debug.Log("New upgrade added!" + arg1 + " ID is: " + arg2._id + " rest is: " + arg2.ToString());

            PrizmRecord <UpgradeSchema> record = upgradeRecordGroup.LookUpPrizmRecordBy_ID(arg2._id);

            if (record == null)
            {
                return;
            }
            //giveRoadToPlayer(record.mongoDocument.myOwner, record);
        };

        upgradeRecordGroup.mongoCollection.DidChangeRecord += (string arg1, UpgradeSchema arg2, IDictionary arg3, string[] arg4) => {
            Debug.Log("upgrade changed! SessionID: " + arg1 + " key is: " + arg2.key + " rest is: " + arg2.ToString());

            PrizmRecord <UpgradeSchema> record = upgradeRecordGroup.LookUpPrizmRecordBy_ID(arg2._id);
            if (record == null)
            {
                return;
            }

            GameObject obj = record.gameObject;
            // ...do something with GameObject


            //Road road = obj.GetComponent<Road>();
            // ...do something with Road
        };

        upgradeRecordGroup.mongoCollection.DidRemoveRecord += (string arg1) => {
            Debug.Log("upgrade removed! _id: " + arg1);

            PrizmRecord <UpgradeSchema> record = upgradeRecordGroup.LookUpPrizmRecordBy_ID(arg1);
            if (record != null)
            {
                Destroy(record.gameObject);
            }
        };



        //give the ships upgrades somewhere else
        //this simply loads all upgrades from a json

        /*
         * foreach (Player ply in GameManager.Instance.TheOneOfficialAllPlayerListInOrderOfTurns) {
         *      for (int i=0; i<15; i++) {
         *              PrizmRecord<UpgradeSchema> roadRecord = new PrizmRecord<UpgradeSchema> ();
         *              roadRecord.mongoDocument.name = "protein torpedos";
         *              //initialize the rest from json
         *
         *              yield return StartCoroutine (upgradeRecordGroup.AddRecord (roadRecord));
         *              while (roadRecord.gameObject==null){
         *                      Debug.Log ("waiting for database confirmation");
         *                      yield return null;
         *              }
         *              //giveRoadToPlayer(ply,roadRecord);
         *      }
         * }
         */
    }
Пример #10
0
 //call this function in any derived classes with base.Awake()
 protected virtual void Awake()
 {
     dbEntry = new DatabaseEntry ();
     //recordGroup = GameObject.Find ("GameManager").GetComponent<PrizmRecordGroup> ();
     recordGroup = GameObject.FindGameObjectWithTag ("GameManager").GetComponent<PrizmRecordGroup> ();
 }
 //set all variables
 void Awake()
 {
     recordGroup = GameObject.Find ("GameManager").GetComponent<PrizmRecordGroup> ();
     clientInit = GameObject.Find ("GameManager").GetComponent<ClientInitialization> ();
     bootstrap = GameObject.Find ("GameManager").GetComponent<BootstrapHH> ();
     hand = GameObject.Find ("Hand");
     debugList = new List<string> ();
 }
 //meteor connection code needs to be the first to run and connect to database (all further actions depend on finishing this initialization)
 void Awake()
 {
     recordGroup = GetComponent<PrizmRecordGroup> ();
     deviceID = SystemInfo.deviceUniqueIdentifier;	//assign device UID for server
     gameManager = GetComponent<GameManager_TT> ();
 }
Пример #13
0
 void Awake()
 {
     recordGroup  = GetComponent <PrizmRecordGroup>();
     gameManager  = GetComponent <GameManager> ();
     tabletopInit = GetComponent <TabletopInitialization> ();
 }
    int numberOfPlayers;                                                //is determined by userIDs that are in list

    //meteor connection code needs to be the first to run and connect to database (all further actions depend on finishing this initialization)
    void Awake()
    {
        recordGroup = GetComponent <PrizmRecordGroup> ();
        deviceID    = SystemInfo.deviceUniqueIdentifier;        //assign device UID for server
        gameManager = GetComponent <GameManager_TT> ();
    }
 void Awake()
 {
     //obtain unique ID for device
     deviceID = SystemInfo.deviceUniqueIdentifier;
     recordGroup = GameObject.Find ("HH_GameManager").GetComponent<PrizmRecordGroup> ();
     gameManager = GameObject.Find ("HH_GameManager").GetComponent<GameManager_HH> ();
     chooseSessionCanvas = GameObject.Find ("ChooseSessionCanvas");
     playerNameCanvas = GameObject.Find ("PlayerNameCanvas");
     msgCanvas = GameObject.Find ("MsgCanvas");
     color = (PlayerColor.color)(Random.Range(0, System.Enum.GetValues(typeof(PlayerColor.color)).Length - 1 ));
     playerNameCanvas.SetActive (false);	//disable "Enter Player Name" for now
 }
Пример #16
0
 void Awake()
 {
     recordGroup = GetComponent<PrizmRecordGroup>();
     gameManager = GetComponent<GameManager_TT> ();
     tabletopInit = GetComponent<TabletopInitialization> ();
 }
Пример #17
0
 void Awake()
 {
     recordGroup = GetComponent <PrizmRecordGroup>();
     bootstrap   = GetComponent <BootstrapTT> ();
 }
Пример #18
0
 //call this function in any derived classes with base.Awake()
 virtual protected void Awake()
 {
     dbEntry     = new DatabaseEntry();
     recordGroup = GameObject.Find("/GameManager").GetComponent <PrizmRecordGroup> ();
 }
Пример #19
0
 //set all variables
 void Awake()
 {
     recordGroup = GameObject.Find("HH_GameManager").GetComponent <PrizmRecordGroup> ();
     clientInit  = GameObject.Find("HH_GameManager").GetComponent <ClientInitialization> ();
     bootstrap   = GameObject.Find("HH_GameManager").GetComponent <BootstrapHH> ();
 }
Пример #20
0
    public IEnumerator ConfigureShipDatabase()
    {
        Debug.Log("Trying to create ship collection");
        shipRecordGroup = new PrizmRecordGroup <ShipSchema> (sessionID, "shipYard");
        yield return(StartCoroutine(shipRecordGroup.CreateMeteorCollection()));

        Debug.Log("CREATED OUR METEOR COLLECTION FOR the ships");


        //set up handlers
        shipRecordGroup.mongoCollection.DidAddRecord += (string arg1, ShipSchema arg2) => {
            //Debug.Log ("New Ship Added! "+arg1 +" ID is: "+arg2._id+" name is: " + arg2.name);


            Debug.Log("PRINTING name: " + arg2.name);
            Debug.Log("PRINTING owner: " + arg2.owner);
            Debug.Log("PRINTING faction: " + arg2.faction);
            Debug.Log("PRINTING isStressed: " + arg2.isStressed.ToString());
            Debug.Log("PRINTING second action: " + arg2.actions[1]);
            Debug.Log("PRINTING maneuvers count: " + arg2.maneuvers.Count.ToString());
            Debug.Log("PRINTING fourht maneuver: " + arg2.maneuvers[3].Serialize().ToString());

            Debug.Log("PRINTING fifth maneuver difficulty: " + arg2.maneuvers[4].difficulty.ToString());
            Debug.Log("PRINTING currentshield: " + arg2.currentShield.ToString());
            Debug.Log("PRINTING selectedUpgrades: " + arg2.selectedUpgrades.ToString());
            Debug.Log("PRINTING selectedUpgrades count: " + arg2.selectedUpgrades.Count.ToString());
            Debug.Log("PRINTING second pilot: " + arg2.pilots[1].Serialize().ToString());
            Debug.Log("PRINTING second pilot ability: " + arg2.pilots[1].ability);



            PrizmRecord <ShipSchema> record = shipRecordGroup.LookUpPrizmRecordBy_ID(arg2._id);
            //if record == null, implies record was created by the server
            if (record == null)
            {
                PrizmRecord <ShipSchema> newRecord = new PrizmRecord <ShipSchema>();

                newRecord.mongoDocument = arg2;

                newRecord.recordGroup         = shipRecordGroup;
                newRecord.mongoDocument._GUID = System.Guid.NewGuid();
                newRecord.mongoDocument.key   = shipRecordGroup.collectionKey;


                shipRecordGroup.associates.Add(newRecord);
            }

            //instantiate the ship
        };


        shipRecordGroup.mongoCollection.DidChangeRecord += (string arg1, ShipSchema arg2, IDictionary arg3, string[] arg4) => {
            Debug.Log("Resource changed! SessionID: " + arg1 + " key is: " + arg2.key + " rest is: " + arg2.ToString());
            //Debug.Log("checking if things change on both ends automatically");
            //Debug.Log("record side: " + arg2.selectedAction);

            //this record automagically has all the same attributes as arg2 (no need to re-assign them)
            PrizmRecord <ShipSchema> record = shipRecordGroup.LookUpPrizmRecordBy_ID(arg2._id);
            if (record == null)
            {
                return;                                 //didn't find the record in the recordgroup
            }
            ///Debug.Log(" unity side: " + record.mongoDocument.selectedAction);
            Debug.Log("unity side, checking _guid and _id" + record.mongoDocument._GUID + ":" + record.mongoDocument._id);
        };

        shipRecordGroup.mongoCollection.DidRemoveRecord += (string arg1) => {
            Debug.Log("Destroyed a Resource Record " + arg1);
            PrizmRecord <ShipSchema> record = shipRecordGroup.LookUpPrizmRecordBy_ID(arg1);
            if (record != null)
            {
                Destroy(record.gameObject);
            }
        };

        //make like 2 ships instantiated in database
        //load all from json l8tr g8tr


        /*
         * for (int i=0; i<2; i++) {
         *      Debug.Log ("Trying to make a bunch of WHEAT! lol jk, im makin ships");
         *      PrizmRecord<ShipSchema> shipRecord = new PrizmRecord<ShipSchema>();
         *      shipRecord.mongoDocument.name = "Tie Fighter";
         *
         *      //set up the rest of the stuff later,
         *      //probably load from a JSON that contains configurations for available ships
         *
         *
         *      yield return StartCoroutine (shipRecordGroup.AddRecord (shipRecord));
         * }
         */


        yield return(null);
    }
 void Awake()
 {
     recordGroup = GetComponent<PrizmRecordGroup>();
     bootstrap = GetComponent<BootstrapTT> ();
 }
Пример #22
0
    public IEnumerator ConfigureObstacleDatabase()
    {
        Debug.Log("Creating obstacles into database...");
        //GameManager.Instance.GameStateReporter.text = "Game is creating DB records and\ndistributing all starting items to PLAYERS";

        obstacleRecordGroup = new PrizmRecordGroup <ObstacleSchema> (sessionID, "obstacles");
        yield return(StartCoroutine(obstacleRecordGroup.CreateMeteorCollection()));

        obstacleRecordGroup.mongoCollection.DidAddRecord += (string arg1, ObstacleSchema arg2) => {
            Debug.Log("New obstacle added!" + arg1 + " ID is: " + arg2._id + " rest is: " + arg2.ToString());

            PrizmRecord <ObstacleSchema> record = obstacleRecordGroup.LookUpPrizmRecordBy_ID(arg2._id);

            if (record == null)
            {
                return;
            }
            //giveRoadToPlayer(record.mongoDocument.myOwner, record);
        };

        obstacleRecordGroup.mongoCollection.DidChangeRecord += (string arg1, ObstacleSchema arg2, IDictionary arg3, string[] arg4) => {
            Debug.Log("obstacle changed! SessionID: " + arg1 + " key is: " + arg2.key + " rest is: " + arg2.ToString());

            PrizmRecord <ObstacleSchema> record = obstacleRecordGroup.LookUpPrizmRecordBy_ID(arg2._id);
            if (record == null)
            {
                return;
            }

            GameObject obj = record.gameObject;
            // ...do something with GameObject


            //Road road = obj.GetComponent<Road>();
            // ...do something with Road
        };

        obstacleRecordGroup.mongoCollection.DidRemoveRecord += (string arg1) => {
            Debug.Log("obstacle removed! _id: " + arg1);

            PrizmRecord <ObstacleSchema> record = obstacleRecordGroup.LookUpPrizmRecordBy_ID(arg1);
            if (record != null)
            {
                Destroy(record.gameObject);
            }
        };


        //make obstacles? will implement later after combat
        //obstacles probably will get generated in-game anyways
        for (int i = 0; i < 2; i++)
        {
            PrizmRecord <ObstacleSchema> obstacleRecord = new PrizmRecord <ObstacleSchema>();
            obstacleRecord.mongoDocument.size     = 1;
            obstacleRecord.mongoDocument.position = new int[2] {
                1, 2
            };
            yield return(StartCoroutine(obstacleRecordGroup.AddRecord(obstacleRecord)));

            while (obstacleRecord.gameObject == null)
            {
                Debug.Log("waiting for database confirmation");
                yield return(null);
            }
        }

        yield return(null);
    }