Ejemplo n.º 1
0
    }// End OnTriggerEnter

    private void HitPickupBox()
    {
        int fakeRacePosVal;

        //Play pickupBox sound, determine what type of pickupbox we get, set image on canvas
        if (user)                                                                                                                                                        //CollisionHandler is used on both the user and dummy cars, we don't want to change the image and other things on the dummy cars
        {
            BroadcastMessage("PlayPickupBoxSound");
            player4RacePos = raceManager.FindPlayerFourRacePosition();                                          // Our raceposition is used to determine what box we get
            pickupBoxType  = pickupBoxManager.DecideWhichPickupBox(player4RacePos);                             // pickupBoxType is a static that holds the value of our current pickupbox
            pickupBoxManager.SetPickupBoxImage((int)pickupBoxType);
        }
        else
        {
            //Used for dummy racers
            player4RacePos = raceManager.FindPlayerFourRacePosition();                                                          // Our raceposition is used to determine what box we get
            if (player4RacePos == 1)                                                                                            // If player4 is in first, we don't want to give the dummies cones constantly.  We will use a strategy for #3 which is slightly more speed and projectiles
            {
                fakeRacePosVal = 3;
            }
            else
            {
                fakeRacePosVal = 2;
            }
            pickupBoxType = pickupBoxManager.DecideWhichPickupBox(fakeRacePosVal);                              // pickupBoxType is a static that holds the value of our current pickupbox
        }
    }// End
Ejemplo n.º 2
0
    void Start()
    {
        pickupBoxManager = GameObject.FindObjectOfType <PickupBoxManager>();
        unityAdsManager  = GameObject.FindObjectOfType <UnityAdsManager>();
        raceManager      = GameObject.FindObjectOfType <RaceManager>();
        if (user)
        {
            playerEngineSound = GameObject.FindObjectOfType <PlayerEngineSound>();              //Used to stop engine sound at race finish
            //Enable speed burst if user has gotten coins from watching video
            if (UnityAdsManager.PLAYER_COINS > 0)
            {
                //Enable speed burst, decrement coin count, set pickupbox image to speed burst
                pickupBoxType = PickupBoxManager.pickupBoxKind.SPEED;
                unityAdsManager.DecrementPlayerCoinCount();
                pickupBoxManager.SetPickupBoxImage(2);                                                                          //Set to speed image
            }
            else
            {
                pickupBoxType = PickupBoxManager.pickupBoxKind.EMPTY;
                pickupBoxManager.SetPickupBoxImage(3);                                                                          //Set image to empty
            }
        }

        //The following is used when we cross the finish line, we can report what player we are
        if (this.CompareTag("Player1"))
        {
            iAmThisPlayer = 1;
        }
        else if (this.CompareTag("Player2"))
        {
            iAmThisPlayer = 2;
        }
        else if (this.CompareTag("Player3"))
        {
            iAmThisPlayer = 3;
        }
        else if (this.CompareTag("Player4"))
        {
            iAmThisPlayer = 4;
        }
    }    //End
Ejemplo n.º 3
0
    }    // End

    private void ResetPickupBox()
    {
        //Clear the variable and set the pickupBox image to transparent
        collisionHandler.pickupBoxType = PickupBoxManager.pickupBoxKind.EMPTY;   //This sets the variable to empty
        pickupBoxManager.SetPickupBoxImage((int)collisionHandler.pickupBoxType); // This clears the image from our canvas
    }                                                                            // End