// Use this for initialization
 void Start()
 {
     abilityCountDown = abilityCountDownInitial;
     PlayerScript     = GetComponent <PlayerScriptCS>();
     vfxObj           = PlayerScript.vfxObj;
     InvokeRepeating("Countdown", 0, 1);
 }
Exemple #2
0
    void Awake()
    {
        LevelsController = GameObject.Find("LevelsController").GetComponent <LevelsControllerCS>();

        //--hide the score modal so we can show it later
        ScoreModal.SetActive(false);

        Player1         = LoadPlayer("Player1Dummy", 1);
        Player2         = LoadPlayer("Player2Dummy", 2);
        Player1Script   = Player1.GetComponent <PlayerScriptCS>();
        Player2Script   = Player2.GetComponent <PlayerScriptCS>();
        Player1Movement = Player1.GetComponent <PlayerMovementCS>();
        Player2Movement = Player2.GetComponent <PlayerMovementCS>();

        //--hide the "play again" button initially, so we can show it later
        PlayAgainBtn.SetActive(false);

        //--set the players to know what they are
        if (LevelsController.p1SelectedCharString.Length > 0)
        {
            Player1Script.playerCharacter = LevelsController.p1SelectedCharString;
        }
        else
        {
            Player1Script.playerCharacter = defaultPlayer;
        }

        if (LevelsController.p2SelectedCharString.Length > 0)
        {
            Player1Script.playerCharacter = LevelsController.p2SelectedCharString;
        }
        else
        {
            Player1Script.playerCharacter = defaultPlayer;
        }

        //--if the game is single player, disable the normal player movement script
        //--and activate the object containing single player scripts
        if (LevelsController.singlePlayer)
        {
            Debug.Log("this is single player mode");
            Player2.GetComponent <PlayerMovementCS>().enabled = false;
            Player2.transform.Find("PlayerSeeker").gameObject.SetActive(true);
            RBtn.SetActive(false);
            RInstruction.SetActive(false);
        }
        else
        {
            Debug.Log("disable playerseeker");
            Player2.transform.Find("PlayerSeeker").gameObject.SetActive(false);
            RBtn.SetActive(true);
        }

        Debug.Log("start the level");
        gameObject.SendMessage("StartLevel", 0);

        //--get the advert script - load last
        AdvertController = GetComponent <AdvertControllerCS>();
    }
Exemple #3
0
    void Start()
    {
        PlayerController = GetComponent <PlayerScriptCS>();

        rb = GetComponent <Rigidbody>();
    }