Пример #1
0
 public void OnBtnClick()
 {
     for (int i = 0; i < curItem.ParamCount; i++)
     {
         curItem.ParamObjs[i] = inputs[i].text;
     }
     GMController.ReceiveGM(curItem);
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     instance   = this;
     isGameOver = false;
     lives      = GlobalGameController.Instance.Lives;
     scores     = GlobalGameController.Instance.Score;
     UpdateStatsUI();
 }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        if (gmInstance == null)
        {
            gmInstance = this;
        }

        //instance addEnergyPrefab At Random Position
        for (int i = 0; i < numberofSpawn; i++)
        {
            Vector3 randomPos = new Vector3(Random.Range(-15, 15), 0.4f, Random.Range(-15, 15));

            if (Random.Range(0, 2) < 1)
            {
                Instantiate(addEnergyPrefab, randomPos, Quaternion.identity);
            }
            else
            {
                Instantiate(minusEnergyPrefab, randomPos, Quaternion.identity);
            }
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        if (gmInstance == null)
        {
            gmInstance = this;
        }

        /*
         * // Instantate addEnergyPrefab At Random Position //
         * for (int i = 0; i < numberOfSpawn; i++)
         * {
         *  Vector3 randomPos = new Vector3(Random.Range(-15, 15), 0, Random.Range(-15, 15));
         *
         *  if (Random.Range(0, 2) < 1)
         *  {
         *      Instantiate(addEnergyPrefab, randomPos, Quaternion.identity);
         *  }
         *  else
         *  {
         *      Instantiate(minusEnergyPrefab, randomPos, Quaternion.identity);
         *  }
         * }
         */
        int Size = 10;

        while (Size > 0)
        {
            RandomPos = Random.Range(0, EnergyCubePrefab.Length);

            // Total Random size
            Vector3 randomPos = new Vector3(Random.Range(-15, 15), 0, Random.Range(-15, 15));

            // Create Object
            Instantiate(EnergyCubePrefab[RandomPos], randomPos, Quaternion.identity);

            Size--;
        }
    }
Пример #5
0
 protected override void Awake()
 {
     base.Awake();
     m_GM = GetComponent <GMController>();
 }
Пример #6
0
    //------------------------------------------------------------------
    void Awake()
    {
        #region SINGLETON
        //Check if instance already exists
        if (instance == null)
        {
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        #endregion

        // Sum up scenes and enemies
        totalScenes = maxEasyScenes + maxMediumScenes + maxHardScenes;
        maxEnemy    = maxBats + maxNinja + maxKamikaze + maxSpiders + maxDogs + maxSentinel; //sum if all enemy types

        //Get all the players required for the current game mode
        if (currentMode != GAMEMODE.Menu)
        {
            inGame = true;

            // if the total score array doesn't exist the initialize one
            if (playersTotalScore == null)
            {
                playersTotalScore = new int[playersRequired];
            }

            // GETS THE REQUIRED COMPONENTS FOR THIS MODE
            UI                 = FindObjectOfType <UIManager3D>();
            bonusWeapon        = UI.rewardPanel.GetComponent <BonusWeapon>();
            currentEventSystem = UI.eventSystem;
            inputModule        = currentEventSystem.GetComponent <CustomInputModule>();
            CrescentScoreOrder = new int[playersRequired];
            for (int i = 0; i < CrescentScoreOrder.Length; i++)
            {
                CrescentScoreOrder[i] = -1;
            }
            playerInfo = new PlayerInfo[playersRequired];

            //spawn players and add them to the current playerInfo list, collect spawn and enemy info
            PlayerSetup();
            StartEnemyCount();
            CollectEnemySpawns();
            CollectWeaponSpawns();
            // set tension threshold and max bar dimension
            currentTensionMax = (int)(tensionStats.standardBarCapacity * (1 + (tensionStats.multiXPlayer * (playerInfo.Length - 1))));
            tensionThreshold  = currentTensionMax / tensionStats.barDivision;
            TensionBonusSetup();

            //check if controller get connected/disconnected, MUST BE CALLED AFTER THE PLAYER SETUP
            StartCoroutine(ControllerCheck());

            // if the current level is not the first of the current game
            if (levelCount > 1)
            {
                // add weapon of choice
                for (int i = 0; i < playerInfo.Length; i++)
                {
                    SetStartingWeapon(i);
                }
            }
            else
            {
                weaponRewardFromLastLevel = new Weapon3D[playersRequired];
            }
        }

        // refill the scene pool and reset total scores, weaponRewards
        if (currentMode == GAMEMODE.Menu)
        {
            currentEventSystem = GameObject.FindWithTag("EventSystem").GetComponent <EventSystem>();
            inputModule        = currentEventSystem.GetComponent <CustomInputModule>();

            // if there are no inputs selected then assign defaults
            if (selectedInputConfig == null)
            {
                selectedInputConfig = new CharacterControlConfig[playersRequired];
            }

            //check if controller get connected/disconnected
            StartCoroutine(MenuInputCheck());

            inGame            = false;
            currentEasyScenes = new List <string>();
            for (int i = 0; i < easyScenes.Count; i++)
            {
                currentEasyScenes.Add(easyScenes[i]);
            }
            currentMediumScenes = new List <string>();
            for (int i = 0; i < mediumScenes.Count; i++)
            {
                currentMediumScenes.Add(mediumScenes[i]);
            }
            currentHardScenes = new List <string>();
            for (int i = 0; i < hardScenes.Count; i++)
            {
                currentHardScenes.Add(hardScenes[i]);
            }

            weaponRewardFromLastLevel = null;
            playersTotalScore         = null;
            levelCount = 0;
        }
    }