Наследование: MonoBehaviour
Пример #1
0
    void Start()
    {
        // This part is necessary for any spawned prefab
        // This will change to "gameController(Clone)" if we decide to instantiate the gameController
        GameObject gameController = GameObject.Find ("gameController");
        iManager = gameController.GetComponent<inputManager> ();
        tManager = gameController.GetComponent<turnManager> ();
        SS = gameController.GetComponent<functionManager> ();
        dataBase = gameController.GetComponent<statsManager> ();

        myPlayer = this.gameObject;
        time=-1;
        turn=0;
        //actStack = new LinkedList<action>();
    }
    void Start()
    {
        photonView = GetComponent<PhotonView> ();

        // This part is necessary for any spawned prefab
        // This will change to "gameController(Clone)" if we decide to instantiate the gameController
        GameObject gameController = GameObject.Find ("gameController");
        iManager = gameController.GetComponent<inputManager> ();
        tManager = gameController.GetComponent<turnManager> ();
        SS = gameController.GetComponent<functionManager> ();
        //dataBase = gameController.GetComponent<statsManager> ();

        // Photon stuff
        PhotonNetwork.logLevel = PhotonLogLevel.Full;
        PhotonNetwork.ConnectUsingSettings ("0.2");
        StartCoroutine ("UpdateConnectionString");
        PhotonNetwork.autoJoinLobby = true;
    }
    void initPlayer()
    {
        // This part is necessary for any spawned prefab
        // This will change to "gameController(Clone)" if we decide to instantiate the gameController
        GameObject gameController = GameObject.Find ("gameController");
        iManager = gameController.GetComponent<inputManager> ();
        tManager = gameController.GetComponent<turnManager> ();
        SS = gameController.GetComponent<functionManager> ();
        database = GameObject.Find ("stats").GetComponent<statsManager> ();

        myPlayer = this.gameObject;

        energy = database.playerStartEnergy;
        exp.Add("momentum",0);
        exp.Add("explosive",0);
        exp.Add("particle",0);
        exp.Add("field",0);

        hasTech.Add("momentum",true);
        hasTech.Add("explosive",true);
        hasTech.Add("particle",false);
        hasTech.Add("field",false);

        techPanel.Add("momentum",GameObject.Find("momentumPanel"));
        techPanel.Add("explosive",GameObject.Find("explosivePanel"));
        techPanel.Add("particle",GameObject.Find("particlePanel"));
        techPanel.Add("field",GameObject.Find("fieldPanel"));

        time = -1;
        turn = 0;
        waitCount = 0;
        // This is not a permanent solution
        // But it sure ensure that all movements (espeacially ones involving collisions)
        // are done in a stepTime
        speed = 3 / database.stepTime;
        // Temp

        photonView = PhotonView.Get (this);

        // You have to add it as a component for the Update and Start methods to run
        // Pretty disturbing if you think about it...
        // All players start with blaster
        //print ("typeof:" + currWeapon.GetType().ToString ());
        //distinguishes which player is to be controlled
        if (photonView.isMine) {
            iManager.setMyPlayer (this);
            playerIndex = 0;
            playerMenu = GameObject.Find("currentWeaponMenu").GetComponent<playerWpnMenu>();
            playerMenu.setMyPlayer(this);
            // Add blaster as starting weapon
            addWeapon (0);
            setWeapon (0);
            GameObject.Find ("player1Energy").GetComponent<Text> ().text = PhotonNetwork.player.name + ": " +
                                this.energy.ToString ();
            GameObject.Find("Main Camera").GetComponent<cameraMovement>().setPlayer(this.gameObject);
        } else {
            playerIndex = 1;
            // The other player gets a different database for its set of weapons (they are different instances)
            database = Instantiate(database);
            playerMenu = GameObject.Find("oppoentWeaponMenu").GetComponent<playerWpnMenu>();
            playerMenu.setMyPlayer(this);
            GameObject.Find ("player2Energy").GetComponent<Text>().text = PhotonNetwork.otherPlayers[0].name + ": " +
                                this.energy.ToString();
        }
    }
Пример #4
0
    void Start()
    {
        // This part is necessary for any spawned prefab
        // This will change to "gameController(Clone)" if we decide to instantiate the gameController
        GameObject gameController = GameObject.Find ("gameController");
        iManager = gameController.GetComponent<inputManager> ();
        //tManager = gameController.GetComponent<turnManager> ();
        SS = gameController.GetComponent<functionManager> ();
        dataBase = gameController.GetComponent<statsManager> ();

        rend = GetComponent<Renderer>();
    }
    void Start()
    {
        // This part is necessary for any spawned prefab
        // This will change to "gameController(Clone)" if we decide to instantiate the gameController
        tManager = GetComponent<turnManager> ();
        SS = GetComponent<functionManager> ();
        database = GameObject.Find ("stats").GetComponent<statsManager> ();

        targetLine = GetComponent <LineRenderer> ();
        myPlayerIsSet = false;

        // Only temporary
        commandable = false;
        buildButton.SetActive (false);
        maxSteps = database.maxSteps;
        // Only temporary
    }