void Update()
    {
        if (Time.time > nextSpawnTime)
        {
            float secondsBetweenSpawns = Mathf.Lerp(secondsBetweenSpawnsMinMax.y, secondsBetweenSpawnsMinMax.x, Difficulty.GetDifficultyPercent());
            nextSpawnTime = Time.time + secondsBetweenSpawns;

            SpawnLocation location = (SpawnLocation)(Random.Range(0, 3));

            switch (location)
            {
            case SpawnLocation.Top:
                SpawnRandomAnimal();
                break;

            case SpawnLocation.Side:
                SpawnRandomSideAnimal();
                break;

            case SpawnLocation.Both:
                SpawnRandomAnimal();
                SpawnRandomSideAnimal();
                break;

            default:
                SpawnRandomAnimal();
                SpawnRandomSideAnimal();
                break;
            }
        }
    }
Esempio n. 2
0
        private void InitObject(
            LevelObjectView obj,
            ObjectTypeInfo objectTypeInfo,
            ObjectProtoInfo objectProtoInfo,
            SpawnLocation spawnLocation,
            LevelSettings levelSettings)
        {
            obj.transform.rotation =
                Quaternion.Euler(0f, spawnLocation.IsXFlipped ? 180f : 0f, 0f);
            var alternating = obj.GetComponent <AlternatingView>();

            if (alternating != null)
            {
                int materialIndex = UnityEngine.Random.Range(
                    0, objectProtoInfo.AvailableMaterials.Length);
                alternating.Material =
                    objectProtoInfo.AvailableMaterials[materialIndex];
            }

            if (objectTypeInfo.Type == playerObjectType)
            {
                List <int> skillIds = playerStateStorage.Get().SkillIds;

                for (int i = 0; i < skillIds.Count; ++i)
                {
                    Skill        skill       = skillStorage.Get(skillIds[i]);
                    BaseSkill    baseSkill   = skillStorage.GetBase(skill.BaseId);
                    ISkillHelper skillHelper =
                        skillHelperStorage.Get(baseSkill.Type);
                    skillHelper.AddSkill(skill, obj.gameObject);
                }
            }
        }
Esempio n. 3
0
        public void SpawnActor(SpawnLocation location)
        {
            ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);

            if (actorClass == null)
            {
                return;
            }

            uint zoneId;

            if (this is PrivateArea)
            {
                zoneId = ((PrivateArea)this).GetParentZone().actorId;
            }
            else
            {
                zoneId = actorId;
            }

            Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, this, location.x, location.y, location.z, location.rot, location.state, location.animId, null);

            npc.LoadEventConditions(actorClass.eventConditions);

            AddActorToZone(npc);
        }
Esempio n. 4
0
        /// <summary>
        /// Tries to get the <see cref="Vector3"/> used for a specific <see cref="SpawnLocation"/>.
        /// </summary>
        /// <param name="location">The <see cref="SpawnLocation"/> to check.</param>
        /// <returns>The <see cref="Vector3"/> used for that spawn location. Can be <see cref="Vector3.zero"/>.</returns>
        public static Vector3 GetPosition(this SpawnLocation location)
        {
            Transform transform = location.GetDoor();

            if (transform == null)
            {
                return(default);
Esempio n. 5
0
    private void Start()
    {
        for (int i = 0; i < transform.childCount; ++i)
        {
            SpawnLocation sl = transform.GetChild(i).GetComponent <SpawnLocation>();

            float sumWeight = 0;
            foreach (SpawnLocation.Spawn spawn in sl.spawnList)
            {
                sumWeight += spawn.weight;
            }

            foreach (SpawnLocation.Spawn spawn in sl.spawnList)
            {
                if (Random.Range(0.0f, 1.0f) < spawn.weight / sumWeight)
                {
                    if (spawn.prefab == null)
                    {
                        break;                       //chance of no spawn
                    }
                    spawn.prefab.SetActive(false);
                    GameObject go = Instantiate(spawn.prefab);
                    go.SetActive(true);
                    spawn.prefab.SetActive(true);

                    Vector2 randOffset = new Vector2(Random.Range(-1, 1) * 0.1f, Random.Range(-1, 1) * 0.1f);
                    go.transform.position = new Vector2(sl.transform.position.x, sl.transform.position.y) + randOffset;
                    break; //only one per spawn location
                }
            }
        }
    }
    void generateAndLaunch()
    {
        int fruitIndex = Random.Range(0, fullFruitList.Count);
        int spawnIndex = Random.Range(0, leftSpawnGroup.Count);

        GameObject pieceA = GameObject.Instantiate(pieceAList[fruitIndex]);

        pieceA.transform.position = leftSpawnGroup[spawnIndex].transform.position;
        SpawnLocation leftSpawn = leftSpawnGroup[spawnIndex].GetComponent <SpawnLocation>();

        pieceA.GetComponent <SimpleGravity>().velocity =
            generateRandomVector2(leftSpawn.degreeMin, leftSpawn.degreeMax) * leftSpawn.launchSpeed;
        ActiveFruitList.Add(pieceA);
        SetId(pieceA);

        GameObject pieceB = GameObject.Instantiate(pieceBList[fruitIndex]);

        pieceB.transform.position = rightSpawnGroup[spawnIndex].transform.position;
        SpawnLocation rightSpawn = rightSpawnGroup[spawnIndex].GetComponent <SpawnLocation>();

        pieceB.GetComponent <SimpleGravity>().velocity =
            generateRandomVector2(rightSpawn.degreeMin, rightSpawn.degreeMax) * rightSpawn.launchSpeed;
        ActiveFruitList.Add(pieceB);
        SetId(pieceB);
    }
Esempio n. 7
0
    private void populateActors(List <Actor> listToPopulate, int numToHave, string namePrefix)
    {
        while (listToPopulate.Count < numToHave)
        {
            listToPopulate.Add(Instantiate(actorPrefab).GetComponent <Actor>());
        }

        GameObject actorHolder = new GameObject(namePrefix);
        int        i           = 1;

        foreach (Actor a in listToPopulate)
        {
            a.transform.SetParent(actorHolder.transform);
            a.name = namePrefix + ((" 0" + i.ToString())).Right(2);

            if (spawns.Count > 0)
            {
                SpawnLocation sp = Useful.PickRandom <SpawnLocation>(spawns);
                {
                    a.transform.position = sp.transform.position;
                    spawns.Remove(sp);
                }
            }
            i++;
        }
    }
    void CreateGoldenMelon(Vector3 position, SpawnLocation s, Vector3 force)
    {
        if (s == SpawnLocation.Left)
        {
            position = new Vector3(minXPosition, maxYPosition, 0);
        }
        else if (s == SpawnLocation.Right)
        {
            position = new Vector3(maxXPosition, maxYPosition, 0);
            force    = -force;
        }
        else
        {
            force = Vector3.zero;
        }
        GameObject g = CreateFallingObject(GoudenMeloenPrefab, position);

        melonCounter++;
        Rigidbody rb = g.GetComponent <Rigidbody> ();

        rb.AddForce(force);
        g.name             = "GoudenMeloen" + melonCounter;
        g.transform.parent = this.transform;
        g.transform.Rotate(Random.Range(0, 360), 90, 90);
    }
Esempio n. 9
0
    void SpawnBlock()
    {
        SpawnLocation spawn = new SpawnLocation();
        spawn.x = Random.Range(-1, cellCountX + 1);
        spawn.z = Random.Range(-1, cellCountX + 1);

        if (BadValueCheck(spawn))
        {
            SpawnBlock();
            return;
        }

        if (spawn.x != -1 && spawn.z != -1 && 
            spawn.x != cellCountX && spawn.z != cellCountX)
        {
            SpawnBlock();
            return;
        }

        foreach (SpawnLocation spawnLocation in spawnsThisRound)
        {
            if (spawnLocation.x == spawn.x && spawnLocation.z == spawn.z)
            {
                SpawnBlock();
                return;
            }
        }

        Block newBlock = Instantiate<Block>(blockPrefab);        

        newBlock.transform.position = newBlock.transform.position + new Vector3(spawn.x * 20, 0, spawn.z * 20);
        spawnsThisRound.Add(spawn);
        newBlock.SetStartPosition();
        newBlock.cellGrid = this;
    }
Esempio n. 10
0
        public ArmourItem(SpawnLocation l) : base(l)
        {
            Random random = new Random();

            int[] itemOptions = new int[] { 20, 20, 20, 40, 40, 50 };
            this.itemValue = itemOptions[random.Next(6)];
        }
Esempio n. 11
0
 public void SpawnCup(SpawnLocation spawnLocation)
 {
     GetComponentInChildren <MeshCollider>().enabled = true;
     GetComponentInChildren <MeshRenderer>().enabled = true;
     transform.position = spawnLocation.transform.position;
     resetCup();
 }
        public SpawnLocation CreateSpawnLocation(SpawnType _spawnType)
        {
            SpawnLocation retVal = null;

            switch (_spawnType)
            {
            case SpawnType.Wall:
                retVal = new WallSpawnLocation();
                break;

            case SpawnType.Floor:
                retVal = new FloorSpawnLocation();
                break;

            case SpawnType.Ceiling:
                retVal = new CeilingSpawnLocation();
                break;

            case SpawnType.Air:
                retVal = new AirSpawnLocation();
                break;

            case SpawnType.RoomObjects:
                retVal = new RoomObjectsSpawnLocation();
                break;

            default:
                retVal = new SpawnLocation();
                break;
            }
            return(retVal);
        }
Esempio n. 13
0
        public static string PointThings(SpawnLocation loc)
        {
            string name = null;

            switch (loc)
            {
            case SpawnLocation.Escape:
            {
                name = "Outside:187.4,-7.2,-14.4:356.5,179.7";
                break;
            }

            case SpawnLocation.SurfaceNuke:
            {
                name = "Outside:40.6,-11.0,-42.6:1.5,180.3";
                break;
            }

            case SpawnLocation.Shelter:
            {
                name = "EZ_Shelter:0.0,1.4,5.8:-3.1,181.5";
                break;
            }

            case SpawnLocation.SCP173:
            {
                name = "LCZ_173:12.2,17.2,13.3:0.0,90.3";
                break;
            }

            case SpawnLocation.SCP106:
            {
                name = "HCZ_106:19.6,1.4,0.1:0.1,269.9";
                break;
            }

            case SpawnLocation.SCP096:
            {
                name = "HCZ_457:-7.7,1.4,0.0:-1.2,90.3";
                break;
            }

            case SpawnLocation.SCP079:
            {
                name = "HCZ_079:-1.2,1.4,0.1:0.3,269.7";
                break;
            }

            case SpawnLocation.SCP012:
            {
                name = "LCZ_012:6.4,1.4,-0.1:1.5,270.9";
                break;
            }
            }

            return(name);
        }
Esempio n. 14
0
    public void SpawnAtRandomLocation()
    {
        Vector2 tilePos = SpawnLocation.getRandomSpawnTile(world, spawnBiomes, spawnTiles);

        float chunkWorldSpaceInterval = (float)(world.chunkSize * world.tileSize) / 100;
        float featureSpaceInterval    = chunkWorldSpaceInterval / (float)world.chunkSize;

        transform.position = new Vector2(tilePos.x * featureSpaceInterval, tilePos.y * featureSpaceInterval);
    }
Esempio n. 15
0
 private void Spawn(SpawnLocation spawnLocation)
 {
     if (SpawnRandom)
     {
         spawnLocation.Spawn(spawnObjects[UnityEngine.Random.Range(0, spawnObjects.Length)]);
         return;
     }
     spawnLocation.Spawn(ref spawnObjects);
 }
Esempio n. 16
0
        public void Show()
        {
            if (charCreationMenu != null)
            {
                charCreationMenu.GetMenu().Ended += (sender, e) =>
                {
                    if (!(e.Data.ContainsKey("name") && e.Data.ContainsKey("age") && e.Data.ContainsKey("sex")))
                    {
                        charCreationMenu.Show(player);
                        return;
                    }

                    ServerDbContext dbContext = ((GameMode)GameMode.Instance).DbContext;

                    dbContext.Accounts.Attach(player.AccountData);

                    SpawnLocation chrSpawn = new SpawnLocation();
                    chrSpawn.Interior     = 0;
                    chrSpawn.VirtualWorld = 0;
                    chrSpawn.X            = 1762.1357f;
                    chrSpawn.Y            = -1862.8958f;
                    chrSpawn.Z            = 13.5757f;
                    chrSpawn.RotX         = 0f;
                    chrSpawn.RotY         = 0f;
                    chrSpawn.RotZ         = 269.4686f;

                    Inventory inv = new Inventory();
                    inv.MaxSpace = Constants.CHARACTER_INVENTORY_SIZE;

                    Character chr = new Character();
                    chr.Account       = player.AccountData;
                    chr.Name          = (string)e.Data["name"];
                    chr.Age           = (uint)e.Data["age"];
                    chr.Sex           = (Character.CharSex)e.Data["sex"];
                    chr.Skin          = 26;
                    chr.SpawnLocation = chrSpawn;
                    chr.Inventory     = inv;
                    chr.PermsSet      = new PermissionSet();
                    chr.GroupOwner    = new List <Group>();
                    chr.GroupRanks    = new List <GroupRank>();
                    chr.BuildingOwner = new List <Building>();

                    player.ActiveCharacter = chr;

                    dbContext.Add(chr);
                    dbContext.SaveChanges();

                    player.SpawnCharacter();
                };
                charCreationMenu.Show(player);
                return;
            }

            charList.Show(player);
        }
Esempio n. 17
0
    private void CreateMob(Transform prefab, DungeonNode location, float scale, SpawnLocation spawnLocationType)
    {
        Vector3 mobSpawnLocation = GetSpawnLocationInRoom(location, scale, spawnLocationType);

        Transform mob = Instantiate(prefab, mobSpawnLocation, Quaternion.identity) as Transform;

        mob.GetComponent <MonsterActor>().dungeonManager = dungeonManager.GetComponent <DungeonManager>();
        mob.GetComponent <MonsterActor>().room           = new Vector3(location.x, 0, location.z);
        mob.name = prefab.name + location.x + "," + location.z + " " + DungeonManager.dungeonData.grid[location.x, location.z].enemies.Count;
        DungeonManager.dungeonData.grid[location.x, location.z].enemies.Add(mob);
    }
Esempio n. 18
0
        /// <summary>
        /// Tries to get the <see cref="Transform"/> of the door used for a specific <see cref="SpawnLocation"/>.
        /// </summary>
        /// <param name="location">The <see cref="SpawnLocation"/> to check.</param>
        /// <returns>The <see cref="Transform"/> used for that spawn location. Can be null.</returns>
        public static Transform GetDoor(this SpawnLocation location)
        {
            string doorName = location.GetDoorName();

            if (string.IsNullOrEmpty(doorName))
            {
                return(null);
            }

            return(DoorNametagExtension.NamedDoors.TryGetValue(doorName, out var nametag) ? nametag.transform : null);
        }
Esempio n. 19
0
    private void Awake()
    {
        instance = this;
        size     = spawnPoints.Length;

        locations = new SpawnLocation[size];
        for (int i = 0; i < size; i++)
        {
            locations[i] = new SpawnLocation(spawnPoints[i]);
        }
    }
Esempio n. 20
0
    public IEnumerator Spawn_Coroutine(SpawnLocation spawner)
    {
        while (true)
        {
            yield return(new WaitForSeconds(Random.Range(minSec, maxSec)));

            MonoBehaviour spawn = spawner.Spawn();
            spawn.GetComponent <NavMeshAgent>().SetDestination(Target.position);
            Clone clone = spawn.GetComponent <Clone>();
            clone.Invoke("clone.ReturnClone", Random.Range(minSec, maxSec));
        }
    }
    void CheckSpawning()
    {
        EnemyGroup group = null;

        float delta = Time.deltaTime;

        for (int i = enemiesWaitingToSpawn.Count - 1; i >= 0; --i)
        {
            SpawnLocation spawn = enemiesWaitingToSpawn[i];
            spawn.currentTime += delta;

            if (spawn.currentTime >= spawn.timeUntilStart)
            {
                networkView.RPC("PropagateNewSpawnEffect", RPCMode.All, activeTime, enemiesWaitingToSpawn[i].location, enemiesWaitingToSpawn[i].scale);

                // move the SpawnLocation from waitingToSpawn to beingSpawned
                enemiesBeingSpawned.Add(spawn);
                enemiesWaitingToSpawn.RemoveAt(i);

                // reset the values so that they are correct
                spawn.currentTime    = 0;
                spawn.timeUntilStart = activeTime;
            }
        }



        for (int i = enemiesBeingSpawned.Count - 1; i >= 0; --i)
        {
            SpawnLocation spawn = enemiesBeingSpawned[i];
            spawn.currentTime += delta;

            if (spawn.currentTime >= spawn.timeUntilStart)
            {
                GameObject enemy = (GameObject)Network.Instantiate(spawn.prefab, spawn.location, this.transform.rotation, 0);

                EnemyScript script = enemy.GetComponent <EnemyScript>();
                spawn.parentGroup.AddEnemyToGroup(script);
                group = spawn.parentGroup;

                HealthScript health = enemy.GetComponent <HealthScript>();
                health.SetModifier(modifier);

                enemiesBeingSpawned.RemoveAt(i);
            }
        }

        if (enemiesWaitingToSpawn.Count == 0 && enemiesBeingSpawned.Count == 0)
        {
            group.CancelAllOrders();
            Activate(false);
        }
    }
Esempio n. 22
0
    private async void YellowSpawn()
    {
        Debug.Log("Running Query");
        SpawnLocation returnedLocation = await PracticalLocator.Instance.GetSpawnPoint("Yellow Group");

        if (returnedLocation != null)
        {
            Debug.Log("Position: " + returnedLocation.Position);
            Instantiate(YellowDisk, returnedLocation.Position, returnedLocation.Rotation);
            Debug.Log("Yellow disk placed");
        }
    }
Esempio n. 23
0
 private void PopulateLocations()
 {
     spawnLocations = new SpawnLocation[Locations.Length];
     for (int i = 0; i < Locations.Length; i++)
     {
         int prefabIndex = i < spawnObjects.Length ? i : spawnObjects.Length - 1;
         spawnLocations[i] = new SpawnLocation(Locations[i], prefabIndex);
         if (SpawnOnStart)
         {
             Spawn(spawnLocations[i]);
         }
     }
 }
Esempio n. 24
0
        public static Transform GetDoor(this SpawnLocation location)
        {
            if (SpawnLocationData.DoorNames.ContainsKey(location))
            {
                string doorName = SpawnLocationData.DoorNames[location];
                if (DoorNametagExtension.NamedDoors.TryGetValue(doorName, out var nametag))
                {
                    return(nametag.transform);
                }
            }

            return(null);
        }
Esempio n. 25
0
    public IEnumerator SpawnAsteroid()
    {
        GameObject rocketObj = null;

        try
        {
            rocketObj = GameObject.FindGameObjectWithTag("Rocket");
        }
        catch (System.Exception)
        {
            rocketObj = null;
        }

        while (rocketObj != null)
        {
            if (GameObject.FindGameObjectWithTag("Rocket").GetComponent <Rocket>().score % 25 == 0)
            {
                if (spawnSpeed > 1f)
                {
                    spawnSpeed -= 0.5f;
                }
            }
            SpawnLocation wall = (SpawnLocation)UnityEngine.Random.Range(0, 4);

            switch (wall)
            {
            case SpawnLocation.TOP_WALL:
                Vector2 spawnLocationTop = new Vector2(UnityEngine.Random.Range(-2.0f, 2.0f), 6);
                Instantiate(Asteroid, spawnLocationTop, Quaternion.Euler(0, 0, UnityEngine.Random.Range(160, 200)));
                break;

            case SpawnLocation.RIGHT_WALL:
                Vector2 spawnLocationRight = new Vector2(10, UnityEngine.Random.Range(-3.0f, 3.0f));
                Instantiate(Asteroid, spawnLocationRight, Quaternion.Euler(0, 0, UnityEngine.Random.Range(-250, -290)));
                break;

            case SpawnLocation.BOTTOM_WALL:
                Vector2 spawnLocationBottom = new Vector2(UnityEngine.Random.Range(-2.0f, 2.0f), -6);
                Instantiate(Asteroid, spawnLocationBottom, Quaternion.Euler(0, 0, UnityEngine.Random.Range(-20, 20)));
                break;

            case SpawnLocation.LEFT_WALL:
                Vector2 spawnLocationLeft = new Vector2(-10, UnityEngine.Random.Range(-3.0f, 3.0f));
                Instantiate(Asteroid, spawnLocationLeft, Quaternion.Euler(0, 0, UnityEngine.Random.Range(-70, -110)));
                break;
            }

            yield return(new WaitForSeconds(spawnSpeed));
        }
    }
Esempio n. 26
0
 bool BadValueCheck(SpawnLocation spawn)
 {
     if ((spawn.x == -1 && spawn.z == -1) ||
         (spawn.x == -1 && spawn.z == cellCountX) ||
         (spawn.x == -1 && spawn.z == cellCountX) ||
         (spawn.x == cellCountX && spawn.z == cellCountX))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 27
0
        public static Vector3 TryGetLocation(this SpawnLocation location)
        {
            Vector3 pos = Vector3.zero;

            float     modifier  = SpawnLocationData.ReversedLocations.Contains(location) ? -3f : 3f;
            Transform transform = location.GetDoor();

            if (transform != null)
            {
                pos = (transform.position + (Vector3.up * 1.5f)) + (transform.forward * modifier);
            }

            return(pos);
        }
Esempio n. 28
0
    private void ScoreBallDistance(ref SpawnLocation sl, int thisID)
    {
        int num = NetworkManager.instance ? NetworkManager.instance.NumOfConnectedPlayers : 1;

        for (int i = 0; i < num; i++) // Four, for player number
        {
            Vector3 posOfBall = NetworkManager.instance.GetBallOfID(i).transform.position;

            if (Vector3.Distance(posOfBall, sl.location.position) <= 20f)
            {
                sl.score += i != thisID ? 25 : -45;
            }
        }
    }
Esempio n. 29
0
        public override void Loop()
        {
            if (player.isHuman && !player.IsDead)
            {
                if (!player.IsDriving)
                {
                    ResetTarget();
                }
                else if (!ValidTarget(targetPlayer))
                {
                    SetTarget();
                }
                else if (destinationMarker)
                {
                    if (Time.time > timeDeadline)
                    {
                        player.svPlayer.SendGameMessage("Out of Time");
                        SetTarget();
                    }
                    else if (player.TransportWithinReach(destinationMarker))
                    {
                        player.svPlayer.Reward(2, Mathf.CeilToInt(timeDeadline - Time.time));
                        SetTarget();
                    }
                }
                else if (
                    targetPlayer && player.TransportWithinReach(targetPlayer) &&
                    targetPlayer.svPlayer.SvMountBack(player.curMount.ID, false))
                {
                    player.svPlayer.DestroyGoalMarker();

                    SpawnLocation destination = svManager.spawnLocations.GetRandom();

                    destinationMarker = svManager.AddNewEntity(
                        svManager.markerGoalPrefab,
                        SceneManager.Instance.ExteriorPlace,
                        destination.transform.position,
                        Quaternion.identity,
                        new IDCollection <ShPlayer> {
                        player
                    });

                    player.svPlayer.SendGameMessage("Destination: " + destination.locationName);

                    timeDeadline = Time.time + player.Distance(destination.transform.position) * 0.1f + 20f;

                    player.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.ShowTimer, timeDeadline - Time.time);
                }
            }
        }
Esempio n. 30
0
    public void spawn()
    {
        GameObject prefab;

        WaveManager.Instance.EnemyPrefabs.TryGetValue(type, out prefab); //Get the prefab of the enemy

        Enemy enemy;

        for (int i = 0; i < amount; i++)                                                 //Iterate through each enemy
        {
            SpawnLocation randomLocation = WaveManager.Instance.getRandomSpawnPos(Type); //Get a spawn location
            //Get the enemy from the pool
            enemy = SimplePool.Spawn(prefab, randomLocation.Position, Quaternion.identity).GetComponent <Enemy>();

            //Set enemy properties
            enemy.weaponPrefab = WaveManager.Instance.getEnemyWeapon(type, level);

            int lvl = (int)level;

            float multiplier = 1 + (lvl / 10); //Get the multiplier

            Color clr = Color.red;
            if ((int)level <= WaveManager.Instance.EnemyLevelColors.Length)
            {
                clr = WaveManager.Instance.EnemyLevelColors[lvl];
            }

            enemy.SetColor(clr);

            //Apply the multiplier to the enemy's stats
            enemy.Speed     = multiplier;
            enemy.TurnSpeed = multiplier;

            /*enemy.initialHealth = initialHealth;
             * enemy.Reward = rewardAmount;*/

            int[] healthPerLevel = { 1, 3, 5, 10, 20 };
            int[] rewardPerLevel = { 1, 3, 5, 10, 25 };

            enemy.initialHealth = healthPerLevel[lvl];
            enemy.Reward        = rewardPerLevel[lvl];

            //Spawn the enemy
            enemy.Spawn(randomLocation.Position, Quaternion.identity);

            randomLocation.Use(); //Use the random location
        }
        spawned = true;
    }
Esempio n. 31
0
 void SpawnACubatFrom(SpawnLocation _spawner)
 {
     float leftBorder = _spawner.transform.position.x - _spawner.width/2;
     float rightBorder = _spawner.transform.position.x + _spawner.width/2;
     Vector2 spawnPos = new Vector2(Random.Range(leftBorder,rightBorder), _spawner.transform.position.y);
     Cubat cubat = SpawnCubatAt (spawnPos);
     cubat.SetSpawner(this);
     aliveCubatCount += 1;
     cubat.GetIntoField();
 }
Esempio n. 32
0
 void Awake()
 {
     fastSlimePool.Init(Game.instance.enemyLayerGround);
     leftSpawner = GameObject.Find("spawner_left").GetComponent<SpawnLocation>();
     rightSpawner = GameObject.Find("spawner_right").GetComponent<SpawnLocation>();
 }
Esempio n. 33
0
 void SpawnABigSlimeFrom(SpawnLocation _spawner)
 {
     float leftBorder = _spawner.transform.position.x - _spawner.width/2;
     float rightBorder = _spawner.transform.position.x + _spawner.width/2;
     Vector2 spawnPos = new Vector2(Random.Range(leftBorder,rightBorder), _spawner.transform.position.y);
     BigSlime slime = SpawnBigSlimeAt (spawnPos);
     slime.SetSpawner(this);
     aliveBigSlimeCount += 1;
     slime.GetIntoField(_spawner.moveDirection);
 }
Esempio n. 34
0
 void SpawnAFlymonFrom(SpawnLocation _spawner)
 {
     float leftBorder = _spawner.transform.position.x - _spawner.width/2;
     float rightBorder = _spawner.transform.position.x + _spawner.width/2;
     Vector2 spawnPos = new Vector2(Random.Range(leftBorder,rightBorder), _spawner.transform.position.y);
     Flymon flymon = SpawnFlymonAt (spawnPos);
     flymon.SetSpawner(this);
     aliveFlymonCount += 1;
     flymon.GetIntoField();
 }
Esempio n. 35
0
 void Awake()
 {
     topSpawner = GameObject.Find("spawner_top").GetComponent<SpawnLocation>();
     leftSpawner = GameObject.Find("spawner_left").GetComponent<SpawnLocation>();
     rightSpawner = GameObject.Find("spawner_right").GetComponent<SpawnLocation>();
 }