Example #1
0
    //Exit to menu or whatever
    void finishGame()
    {
        ReadAndWriteStats statsManager = GetComponent <ReadAndWriteStats>();

        statsManager.gamesPlayed++;
        statsManager.writeStats();

        //Reset node count

        NodeGenerator.numNodes = 0;

        NodeGenerator.numDepthReached = 0;

        SceneManager.LoadScene("Menu");
    }
Example #2
0
    //Exit to menu or whatever
    void finishGame()
    {
        ReadAndWriteStats statsManager = GetComponent <ReadAndWriteStats>();

        statsManager.gamesPlayed++;
        statsManager.writeStats();


        //Send end game message to server
        GameObject networkGameObject = GameObject.Find("ConnectionHandler");

        //Go back to menu if offline. If online, go back to the lobby?
        if (networkGameObject == null)
        {
            SceneManager.LoadScene("Menu");
        }
        else
        {
            //Wait for message to change scene
        }
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        input = GameObject.Find("Input Handler").GetComponent <InputHandler>();

        //Find hud object  in scene
        findHUD();

        animator = transform.GetChild(0).GetComponent <Animator>();

        Renderer rend = transform.GetChild(0).GetChild(1).GetComponent <SkinnedMeshRenderer>();

        color = rend.material.color;

        //Determine if player 1 for key input purposes. Reverse the values to give keyboard input to player 2.
        if (playerNumber == 0 && !onlineOpponent)
        {
            player1 = true;
        }
        else
        {
            player1 = false;
        }

        //Initialize character controller for movemnet
        controller       = gameObject.GetComponent <CharacterController>();
        cameraController = cameraHandler.GetComponent <CameraController>();

        //Initialize some bomb throwing and bomb crafting related variables
        canThrow             = true;
        firstThrow           = false; //Unusued first throw thing
        bombHandlerReference = GameObject.FindGameObjectsWithTag("BombList")[0];
        bombHandler          = bombHandlerReference.GetComponent <BombCraftingHandler>();
        selectedBomb         = 0;

        statManager = GameObject.Find("GameManager").GetComponent <ReadAndWriteStats>();

        explosionForce = new Vector3(0.0f, 0.0f, 0.0f);

        //Child stuff for throw feedback
        if (!onlineOpponent)
        {
            throwBar   = cameraHandler.transform.GetChild(0).gameObject;
            aimingQuad = transform.GetChild(1).gameObject;
            throwArc   = aimingQuad.GetComponent <LaunchArcMesh>();
        }

        //Inventory stuff
        for (int i = 0; i < 4; i++)
        {
            materialCount[i] = 0;
            materialID[i]    = 0;

            if (!onlineOpponent)
            {
                textForHUD[0].text = materialCount[i].ToString();
            }

            activeCraftingMaterial[i] = false;

            dpadReleased[i] = false;
        }

        //Make sure bomb inventory structure stuff are at default values.
        for (int i = 0; i < 5; i++)
        {
            makeBombDefaults(ref craftedBombs[i]);
        }
        makeBombDefaults(ref newerBomb);
        setInventoryText();

        dyingAnimation = false;

        throwingPower      = -0.1f;
        health             = 100.0f;
        invinciblityFrames = 0.0f;
        //Status effect stuff
        stunned = 0.0f;
        burning = 0.0f;
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        findHUD();

        animator = transform.GetChild(0).GetComponent <Animator>();

        Renderer rend = transform.GetChild(0).GetChild(1).GetComponent <SkinnedMeshRenderer>();

        color = rend.material.color;

        //Determine if player 1 for key input purposes. Reverse the values to give keyboard input to player 2.
        if (playerInputString == "")
        {
            player1 = true;
        }
        else
        {
            player1 = false;
        }

        //Initialize some stuff
        //m_Rigidbody = gameObject.GetComponent<Rigidbody>(); //Get rigid body for movemnt stuff below
        controller           = gameObject.GetComponent <CharacterController>();
        canThrow             = true;
        bombHandlerReference = GameObject.FindGameObjectsWithTag("BombList")[0];
        bombHandler          = bombHandlerReference.GetComponent <BombCraftingHandler>();
        selectedBomb         = 0;

        statManager = GameObject.Find("GameManager").GetComponent <ReadAndWriteStats>();

        explosionForce = new Vector3(0.0f, 0.0f, 0.0f);

        throwBar   = cameraHandler.transform.GetChild(0).gameObject;
        aimingQuad = transform.GetChild(1).gameObject;

        //Inventory stuff
        for (int i = 0; i < 4; i++)
        {
            materialCount[i]          = 0;
            materialID[i]             = 0;
            textForHUD[0].text        = materialCount[i].ToString();
            activeCraftingMaterial[i] = false;

            dpadReleased[i] = false;
        }

        //Make sure bomb inventory structure stuff are at default values.
        for (int i = 0; i < 5; i++)
        {
            makeBombDefaults(ref craftedBombs[i]);
        }
        makeBombDefaults(ref newerBomb);
        setInventoryText();

        dyingAnimation = false;

        throwingPower      = -0.1f;
        health             = 100.0f;
        invinciblityFrames = 0.0f;
        //Status effect stuff
        stunned = 0.0f;
        burning = 0.0f;
    }