Beispiel #1
0
        // Use this for initialization
        void Start()
        {
            /*Obtengo instacion de los GameObject cube*/
            cubeLeftIndicator  = GameObject.FindGameObjectWithTag("cubeLeft");
            cubeRightIndicator = GameObject.FindGameObjectWithTag("cubeRight");

            /*I define the colors that will be used as indicators "indicatorOn" color to designate the exit of the ball
             * "IndicatorOff" Color to indicate the standby time */
            indicatorOn  = new Color(0.2f, 0.2f, 0.2f);
            indicatorOff = new Color(0, 1, 0);
            /*Inicio con ambos cubos con el color de espera*/
            indicatorRight = indicatorOff;
            indicatorLeft  = indicatorOff;

            gameM = GameObject.Find("GameManager").GetComponent <GameManagerAtrapalo>();
            gameM.ballsAlive++;
            angle      = (180 * gameM.level) / 6;
            calc       = new GameAngles(angle, gameM.planeShootFront, gameM.planeShootLat);
            timeLaunch = gameM.launchTime;
            side       = true;

            if (type == 3)
            {
                timeLaunch = timeLaunch / 2;
            }
            timeArrive = Time.time + timeLaunch;
            Vector3 pointIni = transform.position;

            flagArrive = false;
            //posNew = this.GetComponent<Rigidbody>();
        }
Beispiel #2
0
        // Use this for initialization
        void Start()
        {               /*Initialize the canon vector to point the player*/
            gameM = GameObject.Find("GameManager").GetComponent <GameManagerAtrapalo>();
            gameM.ballsAlive++;
            angle      = (180 * gameM.level) / 6;
            calc       = new GameAngles(angle, gameM.planeShootFront, gameM.planeShootLat);
            timeLaunch = gameM.launchTime;
            side       = true;

            if (type == 3)
            {
                timeLaunch = timeLaunch / 2;
            }
            timeArrive = Time.time + timeLaunch;
            Vector3 pointIni = transform.position;

            flagArrive = false;
            //posNew = this.GetComponent<Rigidbody>();
        }
Beispiel #3
0
        public void MakeThingToSpawn()
        {
            angle = (180 * gameM.level) / 6;
            calc  = new GameAngles(angle, true, true);
            //Vector3 spawnPosition;

            /*
             * System.Random rnd = new System.Random();
             * int sideNumber = rnd.Next(1);
             * if (sideNumber == 0)
             * {
             * side = true;
             * }
             * else
             * {
             * side = false;
             * }*/
            int    objectToSpawn = 0;
            string hand          = "";

            if (side)
            {
                Debug.Log("lado der");
                shootPosition("ShoulderRight", "HandRight", "left");
                side          = false;
                objectToSpawn = 1;
                hand          = "right";
            }
            else
            {
                Debug.Log("lado izq");
                shootPosition("ShoulderLeft", "HandLeft", "right");
                side          = true;
                objectToSpawn = 0;
                hand          = "left";
            }

            // get a random position between the specified ranges
            //      spawnPosition.x = Random.Range (xMinRange, xMaxRange);
            //spawnPosition.y = Random.Range (yMinRange, yMaxRange);
            //spawnPosition.z = Random.Range (zMinRange, zMaxRange);

            // determine which object to spawn
            //int objectToSpawn = Random.Range(0, spawnObjects.Length);

            if (objectToSpawn == 0)
            {
                panelIzq.SetActive(true);
                panelDer.SetActive(false);

                leftLight.color  = Color.green;
                rightLight.color = Color.red;
            }
            else
            {
                panelIzq.SetActive(false);
                panelDer.SetActive(true);

                leftLight.color  = Color.red;
                rightLight.color = Color.green;
            }

            // actually spawn the game object
            GameObject spawnedObject = Instantiate(spawnObjects[objectToSpawn], pointFin, spawnObjects[objectToSpawn].transform.rotation) as GameObject;

            // make the parent the spawner so hierarchy doesn't get super messy
            spawnedObject.transform.parent = gameObject.transform;

            Debug.Log("Spawner: " + pointFin.ToString());
            spawnedObject.GetComponent <TargetMover>().StartMoving(pointFin, flTime, upTime);
            spawnedObject.GetComponent <TargetBehavior>().SetHand(hand);
        }