Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Awake()
 {
     instance = this;
     dishes   = new List <string>
     {
         "Curry",
         "Steak",
         "Soup"
     };
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        stopSpawn = false;

        GameObject player = GameObject.FindWithTag("Spawn");     //create reference for Player gameobject, and assign the variable via FindWithTag at start

        if (player != null)                                      // if the playerObject gameObject-reference is not null - assigning the reference via FindWithTag at first frame -
        {
            spawnScript = player.GetComponent <SpawnCustomer>(); // - set the PlayerController-reference (called playerControllerScript) to the <script component> of the Player gameobject (via the gameObject-reference) to have access the instance of the PlayerController script
        }
        if (player == null)                                      //for exception handling - to have the console debug the absense of a player controller script in order for this entire code, the code in the GameController to work
        {
            Debug.Log("Cannot find SpawnCustomer script to stop spawning upon True");
        }
    }
Ejemplo n.º 3
0
    public void SetObjects(GameObject top, GameObject bottom, GameObject red, GameObject green)
    {
        if (agent == null)
        {
            agent = GetComponent <NavMeshAgent>();
        }

        screenTop    = top;
        screenBottom = bottom;
        redTruck     = red;
        greenTruck   = green;

        SpawnCustomer spawnScript = FindObjectOfType <SpawnCustomer>();

        if (Mathf.Abs(spawnScript.GetPosition().z - spawnScript.topSpawnZ) < 0.01f)
        {
            agent.destination = screenBottom.transform.position;
        }

        if (Mathf.Abs(spawnScript.GetPosition().z - spawnScript.bottomSpawnZ) < 0.01f)
        {
            agent.destination = screenTop.transform.position;
        }
    }