Ejemplo n.º 1
0
    private void Awake()
    {
        instance = this;


        SpawnShowCases();
    }
Ejemplo n.º 2
0
 void Start()
 {
     if (spawner == null)
     {
         spawner = FindObjectOfType <GroundSpawner> ();
     }
 }
Ejemplo n.º 3
0
 void Awake()
 {
     Instance      = this;
     activeGrounds = new List <GroundBase>();
     RepositionManager.OnReposition += OnReposition;
     FillPool();
 }
Ejemplo n.º 4
0
 void Awake()
 {
     instance = this;
     InitializeRows();
     InitializeColumns();
     spawnedGroundPieces = new List <GroundPiece> ();
     CreateGround();
 }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 protected virtual void Start()
 {
     myRigidBody            = GetComponent <Rigidbody2D>();
     currentPlaceTileHealth = defaultPlaceTileHealth;
     collector       = GetComponent <CoinCollector>();
     defaultWallTile = wallTile;
     curPlaceCost    = 0;
     activeButton    = defaultActiveButton;
     s = GameObject.Find("Tilemap").GetComponent <GroundSpawner>();
 }
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Spawn ground"))
        {
            GroundSpawner gs = target as GroundSpawner;
            gs.SpawnGround();
        }

        DrawDefaultInspector();
    }
Ejemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();
     player        = GameObject.FindGameObjectWithTag("Player");
     fog           = transform.GetChild(16).GetComponent <ParticleSystem>();
     playerStatus  = GameObject.FindGameObjectWithTag("Player").GetComponent <ChickenStatus>();
     playerStatus.counterEggSpawn++;
     SpawnTrees();
     SpawnFruits();
     //SpawnObstacle();
 }
Ejemplo n.º 8
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
        }

        blockSpawner  = GetComponent <BlockSpawner>();
        cubeSpawner   = GetComponent <CubeSpawner>();
        groundSpawner = GetComponent <GroundSpawner>();
    }
Ejemplo n.º 9
0
 private void CacheReference()
 {
     player          = GameObject.Find("Player");
     GameCanvas      = GameObject.Find("Canvas");
     LevelTrigger    = GameObject.Find("Baria").transform;
     groundSpawner   = FindObjectOfType <GroundSpawner>();
     txtBullet       = GameCanvas.transform.GetChild(0).GetComponent <TextMeshProUGUI>();
     txtDistance     = GameCanvas.transform.GetChild(1).GetComponent <TextMeshProUGUI>();
     txtDisInfect    = GameCanvas.transform.GetChild(2).GetComponent <TextMeshProUGUI>();
     txtLevel        = GameCanvas.transform.GetChild(3).GetComponent <TextMeshProUGUI>();
     beforeStartMenu = GameCanvas.transform.GetChild(4).gameObject;
     afterDieMenu    = GameCanvas.transform.GetChild(5).gameObject;
     afterWinMenu    = GameCanvas.transform.GetChild(6).gameObject;
     playerMovement  = player.GetComponent <PlayerMovement>();
 }
Ejemplo n.º 10
0
    // Start is called before the first frame update
    void Start()
    {
        groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();
        player        = GameObject.FindGameObjectWithTag("Player");
        fog           = transform.GetChild(16).GetComponent <ParticleSystem>();
        playerStatus  = GameObject.FindGameObjectWithTag("Player").GetComponent <ChickenStatus>();
        playerStatus.counterEggSpawn++;
        //SpawnObstacle();
        SpawnTrees();
        SpawnFruits();

        //int frequencyLake = Random.Range(0, 20);
        // if (frequencyLake < 1)
        //  groundSpawner.SpawnLake();
    }
Ejemplo n.º 11
0
    // public static int  totalBottles = 0;
    void Start()
    {
        //Add obstacles to list
        ObstacleList.Add(Obstacle1);
        ObstacleList.Add(Obstacle2);
        ObstacleList.Add(Obstacle3);

        // Add Buildings to list
        BuildingList.Add(Building1);
        BuildingList.Add(Building2);
        BuildingList.Add(Building3);

        groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();
        SpawnObstacle();
        SpawnBottle();
        SpawnBuilding();
    }
Ejemplo n.º 12
0
    // Start is called before the first frame update
    void Start()
    {
        isHit          = false;
        animator       = transform.GetChild(0).gameObject.GetComponent <Animator>();
        chMv           = GetComponent <ChickenMovement>();
        groundSpawner  = GameObject.FindObjectOfType <GroundSpawner>();
        strengthEffect = transform.GetChild(1).gameObject.GetComponent <SpawnEffect>();


        createTargetPatternStrength();
        // createTargetPatternJump();

        // Access chicken's body color
        chk_rendererBD = chickenBody.GetComponent <SkinnedMeshRenderer>();
        chk_rendererWG = chickenWings.GetComponent <SkinnedMeshRenderer>();
        chk_rendererTH = chickenThigs.GetComponent <SkinnedMeshRenderer>();
        originalColor  = chk_rendererBD.material.color;
    }
    /*Obstacles:
     * - half wall
     * - full wall that you need to shoot to break. Shoot only at the special spot. bullseye/aim animation?
     * - tunnel walls (l shaped) that you need to go under
     */

    // Start is called before the first frame update
    void Start()
    {
        groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();

        int randomNumber    = Random.Range(0, 7);
        int randomNumberTwo = Random.Range(0, 7);

        if (randomNumber == randomNumberTwo)
        {
            SpawnObtacles();
        }

        int randomNumber1 = Random.Range(0, 5);
        int randomNumber2 = Random.Range(0, 5);

        if (randomNumber1 == randomNumber2)
        {
            SpawnEnemyShooter();
        }
    }
Ejemplo n.º 14
0
 /// <summary>
 /// Sets the character to the specified spawner
 /// </summary>
 /// <param name="spawnername"></param>
 /// <param name="spawnChar"></param>
 /// <returns></returns>
 public void SpawnerSetSpawn(string spawnername, Character spawnChar)
 {
     if (ZoneManager.Instance.CurrentGround == null)
     {
         DiagManager.Instance.LogInfo("[SE]:ScriptGround.SpawnerDoSpawn(): No ground map loaded!!");
     }
     else
     {
         GroundSpawner spwn = ZoneManager.Instance.CurrentGround.GetSpawner(spawnername);
         if (spwn != null)
         {
             spwn.NPCChar = spawnChar;
         }
         else
         {
             DiagManager.Instance.LogInfo(String.Format("[SE]:ScriptGround.SpawnerDoSpawn(): Couldn't find spawner named {0} on map {1}!",
                                                        spawnername,
                                                        ZoneManager.Instance.CurrentGround.AssetName));
         }
     }
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Make the specified spawner run its spawn method.
 /// </summary>
 /// <param name="spawnername"></param>
 /// <returns></returns>
 public GroundChar SpawnerDoSpawn(string spawnername)
 {
     if (ZoneManager.Instance.CurrentGround == null)
     {
         DiagManager.Instance.LogInfo("[SE]:ScriptGround.SpawnerDoSpawn(): No ground map loaded!!");
     }
     else
     {
         GroundSpawner spwn = ZoneManager.Instance.CurrentGround.GetSpawner(spawnername);
         if (spwn != null)
         {
             return(spwn.Spawn(ZoneManager.Instance.CurrentGround));
         }
         else
         {
             DiagManager.Instance.LogInfo(String.Format("[SE]:ScriptGround.SpawnerDoSpawn(): Couldn't find spawner named {0} on map {1}!",
                                                        spawnername,
                                                        ZoneManager.Instance.CurrentGround.AssetName));
         }
     }
     return(null);
 }
Ejemplo n.º 16
0
 void Start()
 {
     groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();
     SpawnTerrains();
 }
Ejemplo n.º 17
0
    // only 1 egg in the track


    // Start is called before the first frame update
    void Start()
    {
        // Debug.Log("Start first line");
        //Always spawn decor
        groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();
        player        = GameObject.FindGameObjectWithTag("Player");
        playerStatus  = GameObject.FindGameObjectWithTag("Player").GetComponent <ChickenStatus>();
        fog           = transform.GetChild(11).GetComponent <ParticleSystem>();
        barn          = groundSpawner.isBarn;
        eggCounter    = GameObject.FindGameObjectWithTag("GoldenEggCounter");
        eggs          = eggCounter.GetComponent <GoldenEgg>().goldenEgg;

        SpawnTrees();
        playerStatus.counterEggSpawn++;
        // eggTypeId = Random.Range(0, 3);
        int frequencyTypeEgg = Random.Range(0, 3);

        SpawnGoldenEggs();
        if (!barn)  //If not spawn barn
        {
            if (!groundSpawner.isStart)
            {                                           //At the start of the game don't spawn obstacles
             //Choose if spawn a moving obstacle-less chance
                int moving = Random.Range(0, 8 - eggs); //More chance to generate moving obstacles when got more eggs
                if (hardMode)
                {
                    // Avoid creating moving and stationary obstacle
                    if (moving < 2)
                    {
                        SpawnObstacle(true);
                    }
                    else
                    {
                        SpawnObstacle(false);
                        SpawnObstacle(false);
                        if (eggs >= 2 && eggs < 4) //If collected between 2 and 4 eggs, spawn 3rd obstacle
                        {
                            SpawnObstacle(false);
                        }
                        else if (eggs >= 4)
                        { //If collected 4 eggs, spawn 3rd and 4th obstacle
                            SpawnObstacle(false);
                            SpawnObstacle(false);
                        }
                    }
                }
                else
                {
                    if (moving < 2)
                    {
                        SpawnObstacle(true);
                    }
                    else
                    {
                        SpawnObstacle(false);
                        SpawnObstacle(false);
                        if (eggs >= 2 && eggs < 4)
                        { //If collected between 2 and 4 eggs, spawn 3rd obstacle
                            SpawnObstacle(false);
                        }
                        else if (eggs >= 4)
                        { //If collected 4 eggs, spawn 3rd and 4th obstacle
                            SpawnObstacle(false);
                            SpawnObstacle(false);
                        }
                    }
                }
            }

            if (groundSpawner.isStart)
            {
                transform.GetChild(11).gameObject.SetActive(false);
            }
            // Spawn only one type of object on a single tile

            //Spawnpotion less frequent chance


            int frequencyPotion = Random.Range(0, 20);


            if (frequencyPotion < 1)
            {
                SpawnPotion();
            }
            SpawnFruits();
        }
    }
Ejemplo n.º 18
0
 private void Start()
 {
     groundSpawner = GameObject.FindGameObjectWithTag("GameController").GetComponent <GroundSpawner>();
 }
Ejemplo n.º 19
0
 // Start is called before the first frame update
 void Start()
 {
     GroundSpawner = FindObjectOfType <GroundSpawner>();
 }
Ejemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     spawner = GameObject.Find("GroundSpawner").GetComponent <GroundSpawner>();
 }
Ejemplo n.º 21
0
    void SpawnBlock()
    {
        if (blockIndex > 0)
        {
            randomIndex = 1;
            blockIndex--;
        }
        else if (blockIndex == 0)
        {
            blockIndex = numbers[Random.Range(0, 3)];

            int randomMin  = 2;
            int randomizer = Random.Range(0, 2);
            if (randomizer == 1)
            {
                randomMin = 4;
            }

            if (blockCount > 5)
            {
                randomIndex = Random.Range(randomMin, 7);
            }
            else
            {
                randomIndex = Random.Range(4, 5);
            }
        }
        if (randomIndex == 1)
        {
            int random1 = Random.Range(0, 2);  // pick between 1 and 2 to choose which side to spawn the island;
            int random2 = Random.Range(0, 10); // get the chance to spawn an island
            canSpawnIsland = islandSpawners[0].getCanSpawn() && islandSpawners[1].getCanSpawn();

            if (canSpawnIsland && random2 < 3)
            {
                currentBlock = Instantiate(groundPrefab[7], islandSpawners[random1].transform.position, islandSpawners[random1].transform.rotation);

                /*
                 * if (currentBlock.transform.childCount > 0)
                 *  spawnTurretIndicators(currentBlock.transform.childCount);
                 */
                manager.grounds.Add(currentBlock);
            }
        }
        else if (randomIndex == 2)
        {
            blockIndex--;
            SetBlock(randomIndex);
            blockCount--;
            currentBlock.transform.Rotate(0f, 180f, 0f);
            transform.Translate(60, 60, 0);
            currentIndex = randomIndex;
            return;
        }
        else if (randomIndex == 3)
        {
            blockIndex--;
            SetBlock(randomIndex);
            blockCount--;
            currentBlock.transform.Rotate(0f, 180f, 0f);
            transform.Translate(60, -60, 0);
            currentIndex = randomIndex;
            return;
        }
        else if (randomIndex == 4)
        {
            transform.Rotate(0, -90, 0, Space.Self);
        }
        else if (randomIndex == 5)
        {
            transform.Rotate(0, 90, 0, Space.Self);
        }
        else if (randomIndex == 6)
        {
            blockIndex--;
            blockCount /= 2;
            SetBlock(randomIndex);
            transform.Rotate(0, 90, 0, Space.Self);
            transform.Translate(30, 0, 0);
            GroundSpawner go = Instantiate(this, transform.position, transform.rotation);
            go.blockCount = blockCount;
            go.transform.Rotate(0f, 180f, 0f);
            go.transform.Translate(60, 0, 0);
            go.randomIndex = 1;
            go.blockCount  = blockCount;
            manager.groundSpawners.Add(go);
            currentIndex = randomIndex;
            return;
        }

        SetBlock(randomIndex);
        currentIndex = randomIndex;
        transform.Translate(30, 0, 0);
    }
Ejemplo n.º 22
0
 public SpawnScriptItem(LuaEngine.EEntLuaEventTypes eventType, GroundSpawner ent)
 {
     EventType = eventType;
     baseEnt   = ent;
 }
Ejemplo n.º 23
0
 private void Start()
 {
     groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();
 }
Ejemplo n.º 24
0
 // Start is called before the first frame update
 void Start()
 {
     groundSpawner = GameObject.FindObjectOfType <GroundSpawner>();
     SpawnObstacle();
 }