コード例 #1
0
    void Awake()
    {
        LevelManagerObject = GameObject.FindGameObjectWithTag("Level Manager");
        levelManager       = LevelManagerObject.GetComponent <LevelManager>();

        playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
        player          = playerTransform.GetComponent <PlayerController>();
        nav             = GetComponent <NavMeshAgent>();

        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();

        //triggerTarget = GameObject.FindGameObjectWithTag("Trigger Target").transform;

        float a;
        int   b;

        a = ((startingHealth / 100) * gameController.enemyModifier);
        b = Mathf.RoundToInt(a);

        float c;
        int   d;

        c = ((damage / 100) * gameController.enemyModifier);
        d = Mathf.RoundToInt(c);

        isDead          = false;
        currentHealth   = startingHealth + b;
        currentMagazine = startingMagazine;
        damage          = damage + d;
    }
コード例 #2
0
    void Start()
    {
        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();

        highScoreText = GameObject.Find("Canvas/Main Screen/HighScoreText").GetComponent <Text>();

        highScoreText.text = "" + gameController.highScore;
    }
コード例 #3
0
    void Awake()
    {
        SniperGroupA = GameObject.FindGameObjectWithTag("SniperSpawnsA");
        SniperGroupB = GameObject.FindGameObjectWithTag("SniperSpawnsB");
        SniperGroupC = GameObject.FindGameObjectWithTag("SniperSpawnsC");

        FlakGroupA = GameObject.FindGameObjectWithTag("FlakSpawnsA");
        FlakGroupB = GameObject.FindGameObjectWithTag("FlakSpawnsB");
        FlakGroupC = GameObject.FindGameObjectWithTag("FlakSpawnsC");

        playerObject = GameObject.FindGameObjectWithTag("Player");
        player       = playerObject.GetComponent <PlayerController>();

        enemyManager        = GameObject.FindGameObjectWithTag("Enemy Manager");
        enemySpawningScript = enemyManager.GetComponent <EnemySpawning>();

        objectiveText  = GameObject.Find("Canvas/ObjectiveText").GetComponent <Text>();
        objAmountText  = GameObject.Find("Canvas/objAmountText").GetComponent <Text>();
        scoreText      = GameObject.Find("Canvas/scoreText").GetComponent <Text>();
        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();

        defendAreaObjectiveActive  = false;
        KillSnipersObjectiveActive = false;
        FlakCannonsObjectiveActive = false;
        doseAreaDefendExist        = false;

        DefendAreaLocated  = false;        //1
        KillSnipersLocated = false;        //2
        FlakCannonsLocated = false;        //3
        Area1Done          = false;
        Area2Done          = false;
        Area3Done          = false;

        //objArea.isActive = false;
        ObjectivesCompleted = 0;
        EnemySnipersDone    = false;
        FlakCannonsAmount   = 1;
        FlakCannonsKilled   = 0;
        FlakCannonsDone     = false;

        objectiveReward            = objectiveReward * gameController.scoreMultiplier;
        gameController.GlobalScore = 0;

        area1 = Random.Range(1, 4);
        area2 = Random.Range(1, 4);
        area3 = Random.Range(1, 4);

        objectiveText.text = "";
        objAmountText.text = "";

        gameController.gameMusic.Stop();
        gameController.gameMusic.loop   = true;
        gameController.gameMusic.clip   = gameController.gameFile;
        gameController.gameMusic.volume = 0.8f;
        gameController.gameMusic.Play();
    }
コード例 #4
0
    void Start()
    {
        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();

        gamesWonText   = GameObject.Find("Canvas/Main Screen/GamesWonText").GetComponent <Text>();
        gamesLostText  = GameObject.Find("Canvas/Main Screen/GamesLostText").GetComponent <Text>();
        totalKillsText = GameObject.Find("Canvas/Main Screen/TotalKillsText").GetComponent <Text>();

        gamesWonText.text   = "Games Won: " + gameController.gamesWon;
        gamesLostText.text  = "Games Lost: " + gameController.gamesLost;
        totalKillsText.text = "Total Kills: " + gameController.totalKills;
    }
コード例 #5
0
    void Start()
    {
        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();

        snipersCompleted = false;
        snipersActive    = false;
        sniperDeaths     = 0;
        enemyCap         = 10 + gameController.extraEnemies;
        sniperCap        = 1;
        ifSnipersA       = false;
        ifSnipersB       = false;
        ifSnipersC       = false;
        ifSpawningA      = false;
        ifSpawningB      = false;
        ifSpawningC      = false;
        InvokeRepeating("Spawn", spawnTime, spawnTime);
    }
コード例 #6
0
    void Awake()
    {
        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();
        resultText     = GameObject.Find("Canvas/Main Screen/ResultText").GetComponent <Text>();
        scoreText      = GameObject.Find("Canvas/Main Screen/ScoreText").GetComponent <Text>();

        winPanel.SetActive(false);
        losePanel.SetActive(false);

        if (gameController.GlobalGameResult == "win")
        {
            winPanel.SetActive(true);
            resultText.text = "After fierce battling, " + gameController.playerName + " has successfully defended Itter Castle from the Waffen SS assault! A Time Portal has appeared close to " + gameController.playerName + " and without a second thought, jumped through and returned to the present.";
        }

        if (gameController.GlobalGameResult == "lost - defend")
        {
            losePanel.SetActive(true);
            resultText.text = "The Waffen SS has secured a critical position of the castle and effortlessly wiped out any remaining resistance defending Itter Castle. " + gameController.playerName + " has failed to defend the Castle and in turn, has caused a time paradox and will never return home.";
        }

        if (gameController.GlobalGameResult == "lost - snipers")
        {
            losePanel.SetActive(true);
            resultText.text = "The Waffen SS Snipers has managed to kill off key targets which has help the main force to easily take control of Itter Castle and wiped out any remaining resistance defending Itter Castle. " + gameController.playerName + " has failed to defend the Castle and in turn, has caused a time paradox and will never return home.";
        }

        if (gameController.GlobalGameResult == "lost - flak")
        {
            losePanel.SetActive(true);
            resultText.text = "The Flak 88 Cannons has managed to blow out key structure points of Itter Castle to allow the main force to easily assault and take control of Itter Castle and wiped out any remaining resistance defending Itter Castle. " + gameController.playerName + " has failed to defend the Castle and in turn, has caused a time paradox and will never return home.";
        }
        if (gameController.GlobalGameResult == "lost - death")
        {
            losePanel.SetActive(true);
            resultText.text = "Too injured to continue fighting, " + gameController.playerName + " has failed to defend the Castle and in turn, has caused a time paradox and will never return home.";
        }

        scoreText.text = "Score: " + gameController.GlobalScore;
    }
コード例 #7
0
    private void Awake()
    {
        rb  = GetComponent <Rigidbody>();
        col = GetComponent <CapsuleCollider>();

        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();

        wep1  = GameObject.FindGameObjectWithTag("M1Garand");
        wep2  = GameObject.FindGameObjectWithTag("M1A1Thompson");
        wep3  = GameObject.FindGameObjectWithTag("Panzerschreck");
        gara  = wep1.GetComponent <WeaponStats>();
        tommy = wep2.GetComponent <WeaponStats>();
        panz  = wep3.GetComponent <WeaponStats>();

        cam = Camera.main;
        //cam = GetComponentInParent<Camera>();

        messageText = GameObject.Find("Canvas/MessageText").GetComponent <Text>();
        healthText  = GameObject.Find("Canvas/HealthText").GetComponent <Text>();

        isDead        = false;
        currentHealth = startingHealth;
    }
コード例 #8
0
 void Start()
 {
     gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();
 }
コード例 #9
0
 void Start()
 {
     gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();
     buttonObject   = GameObject.Find("HardButton").GetComponent <Button>();
 }