Пример #1
0
        void Start()
        {
            //PlayerPrefs.DeleteAll();

            // If there are no items in the shop, we can't use it
            if (items.Length <= 0)
            {
                return;
            }

            // Get the gamecontroller from the scene so we can update the selected item
            if (gameController == null)
            {
                gameController = GameObject.FindObjectOfType <ECCGameController>();
            }

            // Listen for a click to change to the next item
            buttonNextItem.onClick.AddListener(delegate { ChangeItem(1); });

            // Listen for a click to change to the next item
            buttonPrevItem.onClick.AddListener(delegate { ChangeItem(-1); });

            // Listen for a click to start the game in the current item
            buttonSelectItem.onClick.AddListener(delegate { StartCoroutine("SelectItem"); });
        }
Пример #2
0
 private void Start()
 {
     if (gameController == null)
     {
         gameController = GameObject.FindObjectOfType <ECCGameController>();
     }
 }
Пример #3
0
 private void Start()
 {
     // Hold some variables for easier access
     if (gameController == null)
     {
         gameController = GameObject.FindObjectOfType <ECCGameController>();
     }
 }
Пример #4
0
        void Start()
        {
            transform.eulerAngles += Vector3.up * Random.Range(-randomRotation, randomRotation);


            if (gameController == null)
            {
                gameController = GameObject.FindObjectOfType <ECCGameController>();
            }
        }
Пример #5
0
        void Start()
        {
            // Set a random rotation angle for the object
            transform.eulerAngles += Vector3.up * Random.Range(-randomRotation, randomRotation);

            // Get the gamecontroller from the scene
            if (gameController == null)
            {
                gameController = GameObject.FindObjectOfType <ECCGameController>();
            }
        }
Пример #6
0
        private void Start()
        {
            thisTransform = this.transform;

            // Hold some variables for easier access
            if (gameController == null)
            {
                gameController = GameObject.FindObjectOfType <ECCGameController>();
            }
            if (targetPlayer == null && gameController.gameStarted == true && gameController.playerObject)
            {
                targetPlayer = gameController.playerObject.transform;
            }


            RaycastHit hit;

            if (Physics.Raycast(thisTransform.position + Vector3.up * 5 + thisTransform.forward * 1.0f, -10 * Vector3.up, out hit, 100, gameController.groundLayer))
            {
                forwardPoint = hit.point;
            }

            thisTransform.Find("Base").LookAt(forwardPoint);// + thisTransform.Find("Base").localPosition);

            // If this is not the player, then it is an AI controlled car, so we set some attribute variations for the AI such as speed and chase angle variations
            if (gameController.playerObject != this)
            {
                // Set a random chase angle for the AI car
                chaseAngle = Random.Range(chaseAngleRange.x, chaseAngleRange.y);

                // Set a random speed variation based on the original speed of the AI car
                speed += Random.Range(0, speedVariation);
            }

            // If there is a health bar in this car, assign it
            if (thisTransform.Find("HealthBar"))
            {
                healthBar = thisTransform.Find("HealthBar");

                healthBarFill = thisTransform.Find("HealthBar/Empty/Full").GetComponent <Image>();
            }

            // Set the max health of the car
            healthMax = health;

            // Update the health value
            ChangeHealth(0);
        }
Пример #7
0
        private void Start()
        {
            thisTransform = this.transform;


            if (gameController == null)
            {
                gameController = GameObject.FindObjectOfType <ECCGameController>();
            }
            if (targetPlayer == null && gameController.gameStarted == true && gameController.playerObject)
            {
                targetPlayer = gameController.playerObject.transform;
            }


            RaycastHit hit;

            if (Physics.Raycast(thisTransform.position + Vector3.up * 5 + thisTransform.forward * 1.0f, -10 * Vector3.up, out hit, 100, gameController.groundLayer))
            {
                forwardPoint = hit.point;
            }

            thisTransform.Find("Base").LookAt(forwardPoint);


            if (gameController.playerObject != this)
            {
                chaseAngle = Random.Range(chaseAngleRange.x, chaseAngleRange.y);


                speed += Random.Range(0, speedVariation);
            }


            if (thisTransform.Find("HealthBar"))
            {
                healthBar = thisTransform.Find("HealthBar");

                healthBarFill = thisTransform.Find("HealthBar/Empty/Full").GetComponent <Image>();
            }


            healthMax = health;


            ChangeHealth(0);
        }
Пример #8
0
        void Start()
        {
            if (items.Length <= 0)
            {
                return;
            }


            if (gameController == null)
            {
                gameController = GameObject.FindObjectOfType <ECCGameController>();
            }


            buttonNextItem.onClick.AddListener(delegate { ChangeItem(1); });


            buttonPrevItem.onClick.AddListener(delegate { ChangeItem(-1); });


            buttonSelectItem.onClick.AddListener(delegate { StartCoroutine("SelectItem"); });
        }