Beispiel #1
0
 void Start()
 {
     spawnerScript      = GameObject.FindGameObjectWithTag("PlatformGenerator").GetComponent <SpawnPlatforms>();
     player             = GameObject.FindGameObjectWithTag("Player");
     destroyer          = GetComponent <Rigidbody2D>();
     destroyer.velocity = new Vector2(0.0f, destroyerSpeed);
 }
    public GameObject playerShield;                                                                   //same as above but for the shield.

    //Awake function which makes sure only on gameManager exists, sets
    //the manager to dontdestroyonload, and initialises some variables.
    void Awake()
    {
        //if statement that checks if instance is null, then
        //sets the instance to this object.
        if (instance == null)
        {
            instance = this;
        }
        //else if statement that checks if the instance is not
        //this object, then destroys it.
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);                                                                //Sets this object to not be destroyed when a new scene is loaded.

        levelGenerator = GetComponent <SpawnPlatforms>();                                             //Sets the level generator to the spawnPlatforms component attached to this object.

        levelGenerator.enabled = false;                                                               //level generator is initialised to false, enabled when the right scene is loaded.
        activePickup           = Pickup.NONE;                                                         //active pickup is initialised to none.
        lives        = 15;                                                                            //lives is initialised to 15.
        level        = 1;                                                                             //level is initialised to 1.
        gameOver     = false;                                                                         //gameOver is initialised to false.
        shieldHealth = 5;                                                                             //shieldhealth initialised to 5.
        maxLevels    = 10;                                                                            //maxLevels initialised to 10.
    }
Beispiel #3
0
 //instantiations for script references
 void Start()
 {
     changeBG     = GameObject.FindGameObjectWithTag("Background").GetComponent <ChangeBackground> ();
     player       = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();
     playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>();
     camera       = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraControl>();
     platforms    = GameObject.FindGameObjectWithTag("Ground").GetComponent <SpawnPlatforms>();
     birds        = GameObject.FindGameObjectWithTag("Bird").GetComponent <BirdAI>();
     enemy1       = GameObject.FindGameObjectWithTag("Enemy1").GetComponent <Enemy1AI>();
 }
	void Start()
	{
		StartGameCanvas.SetActive (true);

		PlayState = false;
		Time.timeScale = 0F;

		_otherScript = spawner.GetComponent<SpawnPlatforms>();
		_moveScript = player.GetComponent<MoveControl>();
		score = _otherScript.getCounter();

		_moveScript.enabled = false;

		//number = score;
	}
Beispiel #5
0
 void Start()
 {
     _AutoMove = gameObject.GetComponent <Auto_Move>();
     _plat     = gameObject.GetComponent <SpawnPlatforms>();
     _drone    = gameObject.GetComponent <SpawnDrones>();
 }
Beispiel #6
0
 void Start()
 {
     instace       = this;
     spawnPlatform = true;
 }