コード例 #1
0
 public void RandomizeExit()
 {
     do
     {
         r = Random.Range(0, 5);
     }while (RunnerOne.GetComponent <ReachExit1>().r == r || RunnerTwo.GetComponent <ReachExit2>().r == r || temp == r);
 }
コード例 #2
0
ファイル: ReachExit1.cs プロジェクト: aayushsharma9/Deception
 void Start()
 {
     reached     = false;
     gameManager = GameObject.Find("GameManager");
     GManager    = gameManager.GetComponent <GameManager>();
     levelCount  = 0;
     paused      = false;
     t           = 0;
     levelCount  = 1;
     exit [0]    = GameObject.FindGameObjectWithTag("Exit1").transform;
     exit [1]    = GameObject.FindGameObjectWithTag("Exit2").transform;
     exit [2]    = GameObject.FindGameObjectWithTag("Exit3").transform;
     exit [3]    = GameObject.FindGameObjectWithTag("Exit4").transform;
     exit [4]    = GameObject.FindGameObjectWithTag("Exit5").transform;
     nav         = GetComponent <UnityEngine.AI.NavMeshAgent> ();
     MoveSpeed   = nav.speed;
     otherScript = RunnerTwo.GetComponent <ReachExit2>();
     r           = Random.Range(0, 5);
 }
コード例 #3
0
    void Start()
    {
        RGlowColor = PlayerPrefs.GetString("GlowColor");

        switch (RGlowColor)
        {
        case "Cyan":
            RColor = Color.cyan;
            break;

        case "Green":
            RColor = Color.green;
            break;

        case "Purple":
            RColor = Color.green;
            break;

        case "White":
            RColor = Color.white;
            break;
        }

        ScoreSpotlight.color           = RColor;
        ScoreSpotlight.bounceIntensity = 8;

        Application.targetFrameRate = 30;
        //PlayerPrefs.DeleteAll();
        Time.timeScale = 0;
        ScoreSpotlight.GetComponent <Animator>().enabled = false;
        //Taking saved Highscore
        level = PlayerPrefs.GetInt("Level");

        switch (level)
        {
        case 1:
            HighScore = PlayerPrefs.GetInt("L1HighScore");
            break;

        case 2:
            HighScore = PlayerPrefs.GetInt("L2HighScore");
            break;
        }

        score = 0;
        CheckSound();

        //Initializing other variables
        RunnerOneScript   = RunnerOne.GetComponent <ReachExit1> ();
        RunnerTwoScript   = RunnerTwo.GetComponent <ReachExit2> ();
        BonusRunnerScript = BonusRunner.GetComponent <BonusReachExit> ();
        RunnerOneScript.r = 3;
        RunnerTwoScript.r = 4;
        Physics.IgnoreCollision(RunnerOne.GetComponent <Collider> (), RunnerTwo.GetComponent <Collider> ());        //Runners will pass through each other
        // PauseScreen = GameObject.FindGameObjectWithTag ("PauseScreen");
        // GameOver = GameObject.FindGameObjectWithTag("GameOverPanel");
        PauseButton.SetActive(false);
        CountDown.SetActive(false);
        GameOver.SetActive(false);
        PauseScreen.SetActive(false);
        BonusRunner.SetActive(false);
        paused        = false;
        gameOver      = false;
        timer         = 0;
        scoreInterval = 0.1f;

        //COUNTING
        countText = CountDown.GetComponent <TextMeshProUGUI>();
        StartCoroutine(GetReady());
    }