Example #1
0
    // void means this function will not return anything  Start is what is run at the start of the game.
    void Start()
    {
        // this is the name of the function we are running
        TemperatureTest();
        Debug.Log(myInt);
        // a loop, for every scenario (whenever i happens to equal 0) there is a set outcome (one enimy is added to the playing field).
        // in this case whenever i is 0 an enimy is added
        for (int i = 0; i < numEnemies; i++)
        {
            // this prints a text saying what was done (which happens to equal the same number as i
            Debug.Log("Creating enemy number: " + i);
        }
        //the name of another function we are running
        myMidterm = GetComponent <MidTerm>();
        // another loop but this time it is showing us what each of the players name's are
        // for every time i is equal to 0 and is still less than the players length  i increases by one
        for (int i = 0; i < players.Length; i++)
        {
            Debug.Log("Player Number " + i + " is named " + players[i].name);
        }
        // this is an Enumeration called my direction
        Direction myDirection;

        // the function is called myDirection
        myDirection = Direction.North;
        // this is putting(passing) the function myDirection into ReverseDirection
        ReverseDirection(myDirection);
    }
Example #2
0
	//void doesn't return anything. Start is starting the function.
	void Start ()
	{
		//
		TemperatureTest();
		//Return myInt.
		Debug.Log (myInt);
		//for is a conditional. int is declaring the type of variable. i is index.
		for(int i = 0; i < numEnemies; i++)
		{
			//Returns Creating enemy number and a number.
			Debug.Log("Creating enemy number: " + i);
		}
		//
		myMidterm = GetComponent<MidTerm>();
		//for is a conditional. int is declaring the type of variable. i is index.
		for(int i = 0; i < players.Length; i++)
		{
			//Returns Player Number # is named (player's name).
			Debug.Log("Player Number "+i+" is named "+players[i].name);
		}
		//Direction is the type. myDirection is the name.
		Direction myDirection;
		//
		myDirection = Direction.North;
		//ReverseDirection is the type. Returns myDirection.
		ReverseDirection (myDirection);
		
	}
    void Start()
    {
        TemperatureTest();
        Debug.Log (myInt);

        for(int i = 0; i < numEnemies; i++)
        {
            Debug.Log("Creating enemy number: " + i);
        }
        myMidterm = GetComponent<MidTerm>();

        for(int i = 0; i < players.Length; i++)
        {
            Debug.Log("Player Number "+i+" is named "+players[i].name);
        }

        Direction myDirection;

        myDirection = Direction.North;

        ReverseDirection (myDirection);
    }
    //THis is a FUnction.  A funciton is like a machine that does something for you in the script.
    //Void is the type of funciton.  Machines or FUncitons usually give you things.  Void spot explaind that this machine is giving you nothing.
    //If it was going to give you something, it would specify the "return Type"  Or call it something like 'int' therefore specifying that an Int would be returned out of the script.
    //THis is a Special Function called Start.  it starts at the begining of the script.
    void Start()     //open brachets are what will happen in this function.
    {
        //This is the function that is created and explained below being called into use now.
        TemperatureTest();

        //This is displaying to the console the value of the variable 'myInt'
        Debug.Log(myInt);

        //THis is a For loop.  Basically, until the conditions are met, it will keep doing what is between the brachets.
        //there are 3 stages of declaring a for loop each seperated by a semi colan.
        //int i = 0 is declaring a variable to use in the statement which is only contained in the loop.  hense usually it is not very creativly named.
        //i < numEnemies is the condition that the loop is waiting to meat.  Basically if the created 'i' is less then numEnemies created at the start of the script.
        //i++ happens after the loop.  In this case it increases the number of i so that the loop has something to work with.
        for (int i = 0; i < numEnemies; i++)
        {
            //The loop is in the brachets and is basically displaying "Creating enemy number:" Plus the value of i so it could display "Creating enemy number: 1"
            Debug.Log("Creating enemy number: " + i);
        }

        //THis is a Getcomponunt script.  We are taking componunts from another script called MidTerm and placing them into the value of myMidTerm
        myMidterm = GetComponent <MidTerm>();

        //another for loop.  This is checkinf if the variable created 'i' is less then the number of game objects stored in the array 'players'.
        //if it is less then the following action will take place in the brachets.
        for (int i = 0; i < players.Length; i++)
        {
            //Displaying to the consol the number of players as the player number and the name.  An example of what it could say would be
            //"Player Number 1 is named 1"
            Debug.Log("Player Number " + i + " is named " + players[i].name);
        }

        //this is creating an enum variable for the enum Direction.  Called myDirection.
        Direction myDirection;

        //myDirection is equal to the value of the Enums North option
        myDirection = Direction.North;
        //RUn the FUnction ReverseDirection with the veriable myDirection plugged into it.  See below for explanation
        ReverseDirection(myDirection);
    }
Example #5
0
    void Start()
    {
        TemperatureTest();
        Debug.Log(myInt);

        for (int i = 0; i < numEnemies; i++)
        {
            Debug.Log("Creating enemy number: " + i);
        }
        myMidterm = GetComponent <MidTerm>();

        for (int i = 0; i < players.Length; i++)
        {
            Debug.Log("Player Number " + i + " is named " + players[i].name);
        }

        Direction myDirection;

        myDirection = Direction.North;

        ReverseDirection(myDirection);
    }
Example #6
0
 // void means this function will not return anything  Start is what is run at the start of the game.
 void Start()
 {
     // this is the name of the function we are running
     TemperatureTest();
     Debug.Log (myInt);
     // a loop, for every scenario (whenever i happens to equal 0) there is a set outcome (one enimy is added to the playing field).
     // in this case whenever i is 0 an enimy is added
     for(int i = 0; i < numEnemies; i++)
     {
     // this prints a text saying what was done (which happens to equal the same number as i
         Debug.Log("Creating enemy number: " + i);
     }
     //the name of another function we are running
     myMidterm = GetComponent<MidTerm>();
     // another loop but this time it is showing us what each of the players name's are
     // for every time i is equal to 0 and is still less than the players length  i increases by one
     for(int i = 0; i < players.Length; i++)
     {
         Debug.Log("Player Number "+i+" is named "+players[i].name);
     }
     // this is an Enumeration called my direction
     Direction myDirection;
     // the function is called myDirection
     myDirection = Direction.North;
     // this is putting(passing) the function myDirection into ReverseDirection
     ReverseDirection (myDirection);
 }
    //open brachets are what will happen in this function.
    //THis is a FUnction.  A funciton is like a machine that does something for you in the script.
    //Void is the type of funciton.  Machines or FUncitons usually give you things.  Void spot explaind that this machine is giving you nothing.
    //If it was going to give you something, it would specify the "return Type"  Or call it something like 'int' therefore specifying that an Int would be returned out of the script.
    //THis is a Special Function called Start.  it starts at the begining of the script.
    void Start()
    {
        //This is the function that is created and explained below being called into use now.
        TemperatureTest();

        //This is displaying to the console the value of the variable 'myInt'
        Debug.Log (myInt);

        //THis is a For loop.  Basically, until the conditions are met, it will keep doing what is between the brachets.
        //there are 3 stages of declaring a for loop each seperated by a semi colan.
        //int i = 0 is declaring a variable to use in the statement which is only contained in the loop.  hense usually it is not very creativly named.
        //i < numEnemies is the condition that the loop is waiting to meat.  Basically if the created 'i' is less then numEnemies created at the start of the script.
        //i++ happens after the loop.  In this case it increases the number of i so that the loop has something to work with.
        for(int i = 0; i < numEnemies; i++)
        {
            //The loop is in the brachets and is basically displaying "Creating enemy number:" Plus the value of i so it could display "Creating enemy number: 1"
            Debug.Log("Creating enemy number: " + i);
        }

        //THis is a Getcomponunt script.  We are taking componunts from another script called MidTerm and placing them into the value of myMidTerm
        myMidterm = GetComponent<MidTerm>();

        //another for loop.  This is checkinf if the variable created 'i' is less then the number of game objects stored in the array 'players'.
        //if it is less then the following action will take place in the brachets.
        for(int i = 0; i < players.Length; i++)
        {
            //Displaying to the consol the number of players as the player number and the name.  An example of what it could say would be
            //"Player Number 1 is named 1"
            Debug.Log("Player Number "+i+" is named "+players[i].name);
        }

        //this is creating an enum variable for the enum Direction.  Called myDirection.
        Direction myDirection;
        //myDirection is equal to the value of the Enums North option
        myDirection = Direction.North;
        //RUn the FUnction ReverseDirection with the veriable myDirection plugged into it.  See below for explanation
        ReverseDirection (myDirection);
    }