Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (!overridePlayerCount)
        {
            playerCount = playerNumInterface.playerNum;
        }
        instance = this;
        if (playerCount > 0)
        {
            player1 = Instantiate(playerPrefab);
            player1.transform.position = P1Spawn.position;
            player1.GetComponent <flightController>().playerNumber = 1;

            player1cam = Instantiate(playerCamPrefab);
            player1cam.GetComponent <ThirdPersonCamera>().poi = player1.GetComponent <flightController>().POI.transform;

            player1.GetComponent <flightController>().cam = player1cam.GetComponent <ThirdPersonCamera>().childCam;

            player1.GetComponent <flightController>().TPC = player1cam;
        }
        if (playerCount > 1)
        {
            player2 = Instantiate(playerPrefab);
            player2.transform.position = P2Spawn.position;
            player2.GetComponent <flightController>().playerNumber = 2;

            player2cam = Instantiate(playerCamPrefab);
            player2cam.GetComponent <ThirdPersonCamera>().poi = player2.GetComponent <flightController>().POI.transform;

            player2.GetComponent <flightController>().cam = player2cam.GetComponent <ThirdPersonCamera>().childCam;

            player2.GetComponent <flightController>().TPC = player2cam;
        }
        if (playerCount > 2)
        {
            player3 = Instantiate(playerPrefab);
            player3.transform.position = P3Spawn.position;
            player3.GetComponent <flightController>().playerNumber = 3;

            player3cam = Instantiate(playerCamPrefab);
            player3cam.GetComponent <ThirdPersonCamera>().poi = player3.GetComponent <flightController>().POI.transform;

            player3.GetComponent <flightController>().cam = player3cam.GetComponent <ThirdPersonCamera>().childCam;

            player3.GetComponent <flightController>().TPC = player3cam;
        }
        if (playerCount > 3)
        {
            player4 = Instantiate(playerPrefab);
            player4.transform.position = P4Spawn.position;
            player4.GetComponent <flightController>().playerNumber = 4;

            player4cam = Instantiate(playerCamPrefab);
            player4cam.GetComponent <ThirdPersonCamera>().poi = player4.GetComponent <flightController>().POI.transform;

            player4.GetComponent <flightController>().cam = player4cam.GetComponent <ThirdPersonCamera>().childCam;

            player4.GetComponent <flightController>().TPC = player4cam;
        }
    }
Exemplo n.º 2
0
 void _MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        anim = GetComponent <Animator>();

        spawner = GameObject.Find("EnemySpawner");
        levels  = GameObject.Find("LevelController").GetComponent <levelController>();
        walkNoise.Play();
    }
Exemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        agents    = GameObject.FindGameObjectsWithTag("aiAgent");
        lvlScript = gameManager.GetComponent <levelController>();

        randomVec = new Vector3(Random.Range(-lvlScript.spawnRadius, lvlScript.spawnRadius),
                                0.5f,
                                Random.Range(-lvlScript.spawnRadius, lvlScript.spawnRadius)) * 0.2f;
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        StartCoroutine(PlaySoundEffect());

        lController = FindObjectOfType <levelController>();

        GetComponent <NavMeshAgent>().SetDestination(target.position);
        damageDistance  = GetComponent <NavMeshAgent>().stoppingDistance;
        damageDistance += damageDistance * 0.5f;
    }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     controller = FindObjectOfType<levelController> ();
     float distance = this.transform.position.z - Camera.main.transform.position.z;
     Vector3 leftCam = Camera.main.ViewportToWorldPoint (new Vector3(0,0,distance));
     Vector3 rightCam = Camera.main.ViewportToWorldPoint (new Vector3(1,0,distance));
     minX = leftCam.x + formationWidth/2;
     maxX = rightCam.x - formationWidth/2;
     SpawnEnemies ();
 }
Exemplo n.º 7
0
 public void Start()
 {
     timesHit = 0;
     isBreakable = (this.tag == "Breakable");
     //Keeping track of breakable bricks
     if (isBreakable) {
         countBreakable++;
         Debug.Log(countBreakable);
     }
     // Assigning controller variable to levelController in the scene
     controller = GameObject.FindObjectOfType<levelController> ();
 }
Exemplo n.º 8
0
 void Awake()
 {
     if (ins == null)
     {
         ins = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
     else if (ins != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     enemies       = new GameObject[3];
     enemies[0]    = enemy1;
     enemies[1]    = enemy2;
     enemies[2]    = enemy3;
     newEnemy      = Instantiate(enemies[(int)Math.Floor((double)UnityEngine.Random.Range(0, 3))], transform.position, Quaternion.identity) as GameObject;
     levels        = GameObject.Find("LevelController").GetComponent <levelController>();
     enemyNumber   = 0;
     enemiesKilled = 0;
     StartCoroutine("spawn");
     //maxEnemies = levels.level*5;
 }
Exemplo n.º 10
0
    void Start()
    {
        health  = 1;
        rb      = GetComponent <Rigidbody2D>();
        spawner = GameObject.Find("EnemySpawner");

        health = spawner.GetComponent <enemySpawner>().health;
        speed  = spawner.GetComponent <enemySpawner>().speed;
        //Tells the spawner that there is an enemy active
        spawner.gameObject.SendMessage("enemyIsAlive");
        levels = GameObject.Find("LevelController").GetComponent <levelController>();
        coll   = gameObject.GetComponent <Collider2D>();
    }
    // Use this for initialization
    void Start()
    {
        Texture2D texf = Resources.Load("Buildings/front/1") as Texture2D;
        Texture2D texs = Resources.Load("Buildings/side/1") as Texture2D;

        Material[]      all    = new Material[3];
        levelController levcon = GameObject.FindGameObjectWithTag("GameController").GetComponent <levelController> ();

        transform.localScale = new Vector3(transform.lossyScale.x, 1, transform.lossyScale.y * (texf.height / texf.width));
        all [0] = buildingMaterialImporter.getBuildingMaterial(ref levcon.wallTextureCache);
        all[1]  = buildingMaterialImporter.getBuildingMaterial(ref levcon.wallTextureCache, "Buildings/front/1", 0.3f, 0.33f);
        all[2]  = buildingMaterialImporter.getBuildingMaterial(ref levcon.wallTextureCache, "Buildings/side/1", 0.3f, 0.33f);
        transform.GetComponent <MeshRenderer> ().materials = all;
    }
Exemplo n.º 12
0
    public void AddBuilding(string sideTexture, string frontTexture)
    {
        GameObject mesh = Resources.Load("buildingCube") as GameObject;

        Material[]      all    = new Material[3];
        levelController levcon = GameObject.FindGameObjectWithTag("GameController").GetComponent <levelController> ();

        all [0] = buildingMaterialImporter.getBuildingMaterial(ref levcon.wallTextureCache);
        all[1]  = buildingMaterialImporter.getBuildingMaterial(ref levcon.wallTextureCache, "Buildings/front/" + frontTexture, 0.3f, 0.33f);
        all[2]  = buildingMaterialImporter.getBuildingMaterial(ref levcon.wallTextureCache, "Buildings/side/" + sideTexture, 0.3f, 0.33f);
        mesh.transform.localScale = new Vector3(mesh.transform.lossyScale.x, 1, mesh.transform.lossyScale.y * (all[1].GetTexture("_BumpMap").height / all[1].GetTexture("_BumpMap").width));
        mesh.transform.GetComponent <MeshRenderer> ().materials = all;
        this.Add(mesh);
    }
Exemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     nivel = FindObjectOfType <levelController>();
 }
Exemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     spawner = GameObject.Find("EnemySpawner");
     StartCoroutine("fire");
     levels = GameObject.Find("LevelController").GetComponent <levelController>();
 }
Exemplo n.º 15
0
    void Start( )
    {
        if (PlayerPrefs.GetInt("isFirstGame") == 0)
        {
            isFirstGame = true;
        }
        resetPossibleNumbers = possibleNumbers;
        isLevelController    = GameObject.FindWithTag("LevelController");
        if (isLevelController == null)
        {
            isLevelController = (GameObject)Instantiate(levelController);
        }
        isLevelController.GetComponent <leaderbords>( ).SearchCamera( );
        save = isLevelController.GetComponent <levelController>( );
        ads  = isLevelController.GetComponent <ads>( );
        if (PlayerPrefs.GetInt("isMuteSound") == 0)
        {
            soundOn.SetActive(true);
            soundMute.SetActive(false);
            lockS.mute = clock.mute = isLevelController.GetComponent <AudioSource>( ).mute = false;
        }
        else
        {
            soundOn.SetActive(false);
            soundMute.SetActive(true);
            lockS.mute = clock.mute = isLevelController.GetComponent <AudioSource>( ).mute = true;
        }
        if (save.isMenu)
        {
            anim.Play("arrow");
            if (PlayerPrefs.GetInt("AllNumberGame") >= (PlayerPrefs.GetInt("NumberNo") + 1) * 3)
            {
                if (PlayerPrefs.GetInt("NoRateGooglePlay") == 0)
                {
                    rateApp.SetActive(true);
                }
            }
        }
        else
        {
            anim.Play("loadLevel");
        }
        startMarker    = butttonPlay.position;
        timer          = save.timerPass + (isHardGame ? 1 : 0);
        level          = save.lvl;
        textLevel.text = "Уровень " + level;
        if (level <= 4)
        {
            difficult = 4;
        }
        else if (level <= 8)
        {
            difficult = 5;
        }
        else if (level <= 12)
        {
            difficult = 6;
        }
        else if (level <= 16)
        {
            difficult = 7;
        }
        else if (level <= 20)
        {
            difficult = 8;
        }
        else if (level > 20)
        {
            difficult = 9;
        }
        if (isFirstGame)
        {
            password = "******";
        }
        else
        {
            GenerationPassword(difficult);
        }
        timerText[0].text = (int)(timer / 10) + "";
        timerText[1].text = (int)(timer) - ((int)(timer / 10)) * 10 + "";
        timerText[2].text = (int)((timer - Mathf.FloorToInt(timer)) * 10) + "";
        timerText[3].text = (int)((timer - Mathf.FloorToInt(timer)) * 100) - ((int)((timer - Mathf.FloorToInt(timer)) * 10)) * 10 + "";
        difDropdown.onValueChanged.AddListener(delegate {
            DropdownValueChanged(difDropdown);
        });
        difDropdown.value  = PlayerPrefs.GetInt("Difficult");
        attempts           = 1;
        textScore.text     = "Очки: " + save.score;
        textHighScore.text = "Рекорд: " + PlayerPrefs.GetInt("HighScore");

        var curMaxLvl = PlayerPrefs.GetInt("MaxLvl");

        for (int i = 0; i < backgroundObjects.Length; i++)
        {
            if (curMaxLvl > 8 && curMaxLvl <= 16)
            {
                if (i < 6)
                {
                    backgroundObjects[i].interactable = true;
                }
            }
            else if (curMaxLvl > 16)
            {
                backgroundObjects[i].interactable = true;
            }
        }
        if (PlayerPrefs.GetInt("ShowBackgrounds") == 1)
        {
            PlayerPrefs.SetInt("ShowBackgrounds", 0);
            ShowSelectBackground();
        }
    }
Exemplo n.º 16
0
 // Start is called before the first frame update
 void Start()
 {
     archivoDeNivel = FindObjectOfType <levelController>();
 }
Exemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     L = this;
 }
Exemplo n.º 18
0
 // Find our levelController in the scene
 void Start()
 {
     controller = GameObject.FindObjectOfType<levelController> ();
 }
Exemplo n.º 19
0
 void Start()
 {
     parentScript = transform.parent.GetComponent <levelController>();
 }