Ejemplo n.º 1
0
    void Start()
    {
        player              = GameObject.Find("Player");
        rb                  = GetComponent <Rigidbody>();
        rb.constraints      = RigidbodyConstraints.FreezePositionY; //Freezes the player on the y axis
        rend                = this.GetComponent <Renderer>();       //Gets the renderer attached to the game object this script is attached to
        rend.material.color = new Vector4(1.0f, 1.0f, 1.0f);        //Sets the colour of the player at the start to be white
        speed               = 5;                                    //Set enemy movement speed

        enemyEnergy            = 0;
        delta_energySteal      = 10;
        rend.material.color    = new Vector4(0.1f, 0.1f, 0.0f);                  //Start enemy as blackish (slightly varied to differentiate from black hole) then they will change to blue
        playerBehavioursScript = player.GetComponent <PlayerBehavioursScript>(); //Get the PlayerBehavioursScript so that the enemy can reuse code
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        GameObject gameData = GameObject.Find("GameDataObject"); //Get all game objects needed

        player = GameObject.Find("Player");
        enemy  = GameObject.Find("Enemy");

        gameDataScript         = gameData.GetComponent <GameDataScript>();       //This is used to transfer the PK between all scenes
        playerBehavioursScript = player.GetComponent <PlayerBehavioursScript>(); //This is used to allow us to load new data into player and enemy scripts
        enemyScript            = enemy.GetComponent <EnemyScript>();

        dbConnectionString = "URI=file:" + Application.dataPath + "/Database.sqlite"; //filepath

        playerID = gameDataScript.playerKey;


        if (gameDataScript.loaded)
        {
            StartCoroutine("Wait"); //wait so the other objects can fully load (See IEnumerator at bottom of this script)
        }
    }