// initialize.
    void Awake()
    {
        //Create manager if one doesn't exist.
        if (manager != null && manager != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            //Create new gamepad manager instance
            manager = this;
            DontDestroyOnLoad(this.gameObject);

            audioActor             = GetComponent <Audio>();
            itemManager            = GetComponent <ItemManager>();
            lpManager              = GetComponent <LapsManager>();
            posManager             = GetComponent <PositionManager>();
            newPlacementController = GetComponent <NewPlacementController>();
            psActor  = GetComponent <PlayerSelectActor>();
            winActor = GetComponent <WinActor>();

            //Lock gamepadcount based on range
            GamePadCount = Mathf.Clamp(GamePadCount, 1, 4);

            gamepads = new List <xbox_gamepad>();

            //Create gamepads based on gamepad count.
            for (int i = 0; i < GamePadCount; ++i)
            {
                gamepads.Add(new xbox_gamepad(i + 1));
            }
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        objects = GameObject.FindGameObjectsWithTag("Item");

        rend = GetComponentInChildren <Renderer>();
        rend.material.color = new Color(0, 0, 0, 0);
        if (rendblade != null)
        {
            rendblade.material.color = new Color(0, 0, 0, 0);
        }
        npController = GameObject.Find("Manager").GetComponent <NewPlacementController>();
        if (this.gameObject.name == "Buzzsaw(Clone)")
        {
            colliderObject = this.gameObject.transform.Find("SawBlade_001").gameObject.transform.Find("Collider").gameObject;
        }
        else
        {
            colliderObject = this.gameObject.transform.Find("Collider").gameObject;
        }


        colliderObject.SetActive(false);
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        kart           = GetComponent <KartController>();
        steerSpeedCopy = kart.steerSpeed;
        ftCopy         = flashingTimer;
        lapManager     = GameObject.Find("Manager").GetComponent <LapsManager>();
        npcManager     = GameObject.Find("Manager").GetComponent <NewPlacementController>();
        //    checkPointPosition = GameObject.Find("RespawnPoint");
        lapNumber      = 1;
        steerAngleCopy = kart.maxSteerAngle;
        //  lockSteerTime = slickSpinOutTime;
        //Layer mask to ignore the kart.
        layerMask = 1 << LayerMask.NameToLayer("Vehicle");
        layerMask = ~layerMask;
        matCopy   = kartMat.material;
        wheelCopy = wheel1.material;
        //Acquire gamepad based on player number
        flashFull = true;

        greyBackDrop  = GameObject.Find("GreyBackDrop").GetComponent <Image>();
        pauseUI       = GameObject.Find("PauseUIPaused").GetComponent <Image>();
        pauseContinue = GameObject.Find("PauseUIContinue").GetComponent <Image>();
        pauseMenu     = GameObject.Find("PauseUIMainMenu").GetComponent <Image>();

        idleEngine     = GameObject.Find("EngineIdleSound").GetComponent <AudioSource>();
        kartCrash      = GameObject.Find("CrashSound").GetComponent <AudioSource>();
        gasLeak        = GameObject.Find("GasSound").GetComponent <AudioSource>();
        topEngineSpeed = GameObject.Find("TopSpeedSound").GetComponent <AudioSource>();
        explosion      = GameObject.Find("ExplosionSound").GetComponent <AudioSource>();

        for (int i = 1; i <= GamePadManager.Instance.ConnectedTotal(); ++i)
        {
            xbox_gamepad temppad = GamePadManager.Instance.GetGamePad(i);
            switch (playerNumber)
            {
            case 1:
                if (temppad.newControllerIndex == 1)
                {
                    gamepad = temppad;
                }

                break;

            case 2:
                if (temppad.newControllerIndex == 2)
                {
                    gamepad = temppad;
                }

                break;

            case 3:
                if (temppad.newControllerIndex == 3)
                {
                    gamepad = temppad;
                }

                break;

            case 4:
                if (temppad.newControllerIndex == 4)
                {
                    gamepad = temppad;
                }
                break;

            default:
                break;
            }
        }
    }
示例#4
0
    void Start()
    {
        winActor   = this.gameObject.GetComponent <WinActor>();
        endCount   = GameObject.Find("EndCount").GetComponent <Image>();
        npc        = this.gameObject.GetComponent <NewPlacementController>();
        iManager   = this.gameObject.GetComponent <ItemManager>();
        psActor    = this.gameObject.GetComponent <PlayerSelectActor>();
        checkpoint = GameObject.Find("CheckPoint1");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint2");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint3");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint4");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint5");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint6");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint7");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint8");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint9");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint10");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint11");
        checkPoints.Add(checkpoint);

        checkpoint = GameObject.Find("CheckPoint12");
        checkPoints.Add(checkpoint);

        FinishLine = GameObject.Find("StartLine");

        countOne   = GameObject.Find("Startlight1").GetComponent <Image>();
        countTwo   = GameObject.Find("Startlight2").GetComponent <Image>();
        countThree = GameObject.Find("Startlight3").GetComponent <Image>();
        countFour  = GameObject.Find("Startlight4").GetComponent <Image>();

        raceCountdown = GameObject.Find("RaceCountdown").GetComponent <Text>();

        raceRestart = GameObject.Find("RestartRace");
        restartText = raceRestart.GetComponent <Text>();
        posOne      = GameObject.Find("firstPlayer").GetComponent <Image>();
        posTwo      = GameObject.Find("secondPlayer").GetComponent <Image>();
        posThree    = GameObject.Find("thirdPlayer").GetComponent <Image>();
        posFour     = GameObject.Find("fourthPlayer").GetComponent <Image>();
        raceEndsIn  = GameObject.Find("RaceEnd").GetComponent <Image>();
        thirdPlace  = GameObject.Find("thirdPlace").GetComponent <Image>();
        fourthPlace = GameObject.Find("fourthPlace").GetComponent <Image>();
        firstPlace  = GameObject.Find("firstPlace").GetComponent <Image>();
        secondPlace = GameObject.Find("secondPlace").GetComponent <Image>();

        countDown1    = GameObject.Find("CountOneSound").GetComponent <AudioSource>();
        countDown2    = GameObject.Find("CountOneSound").GetComponent <AudioSource>();
        countDown3    = GameObject.Find("CountOneSound").GetComponent <AudioSource>();
        countDownEnd  = GameObject.Find("CountEndSound").GetComponent <AudioSource>();
        engineRevving = GameObject.Find("StartRevSound").GetComponent <AudioSource>();

        switch (psActor.playerCount)
        {
        case 2:
            kart1 = GameObject.Find("PlayerCharacter_001").GetComponent <PlayerActor>();
            kart2 = GameObject.Find("PlayerCharacter_002").GetComponent <PlayerActor>();
            break;

        case 3:

            kart1 = GameObject.Find("PlayerCharacter_001").GetComponent <PlayerActor>();
            kart2 = GameObject.Find("PlayerCharacter_002").GetComponent <PlayerActor>();
            kart3 = GameObject.Find("PlayerCharacter_003").GetComponent <PlayerActor>();

            break;

        case 4:
            kart1 = GameObject.Find("PlayerCharacter_001").GetComponent <PlayerActor>();
            kart2 = GameObject.Find("PlayerCharacter_002").GetComponent <PlayerActor>();
            kart3 = GameObject.Find("PlayerCharacter_003").GetComponent <PlayerActor>();
            kart4 = GameObject.Find("PlayerCharacter_004").GetComponent <PlayerActor>();
            break;
        }

        posOne.enabled      = false;
        posTwo.enabled      = false;
        posThree.enabled    = false;
        posFour.enabled     = false;
        firstPlace.enabled  = false;
        secondPlace.enabled = false;
        thirdPlace.enabled  = false;
        fourthPlace.enabled = false;
        engineRevving.Play();
    }