示例#1
0
        /// <summary>
        /// Вернуть в пул использованный объект
        /// </summary>
        /// <param name="gameObject"></param>
        public void ReturnObject(GameObject returnGameObject)
        {
            ISpawned returnEnemy = returnGameObject.GetComponent <ISpawned>();

            enemies.Add(returnEnemy);
            returnGameObject.SetActive(false);
        }
示例#2
0
    /// <summary>
    ///   Add the entity to the spawned group and add the despawn radius
    /// </summary>
    private void ProcessSpawnedEntity(ISpawned entity, Spawner spawnType)
    {
        // I don't understand why the same
        // value is used for spawning and
        // despawning, but apparently it works
        // just fine
        entity.DespawnRadiusSqr = spawnType.SpawnRadiusSqr;

        entity.SpawnedNode.AddToGroup(Constants.SPAWNED_GROUP);
    }
示例#3
0
        public void Create()
        {
            if (enemies.Count != 0)
            {
                int      rand    = Random.Range(0, enemies.Count);
                ISpawned spawned = enemies[rand];
                enemies.RemoveAt(rand);
                spawned.Spawn();
                return;
            }
            GameObject gameObjectNew = MonoBehaviour.Instantiate(GameController.StaticObject.EnemyFactory.CreateEnemy());

            gameObjectNew.transform.SetParent(ParentEnemyPool);
            gameObjectNew.GetComponent <ISpawned>().Spawn();
        }
示例#4
0
    public IEnumerable <ISpawned> Spawn(Node worldNode, Vector3 location, MicrobeSpecies species, bool isWanderer)
    {
        // The true here is that this is AI controlled
        ISpawned first = Spawn(species, location, worldNode,
                               microbeScene, true, cloudSystem, CurrentGame);

        yield return(first);

        if (species.IsBacteria && !isWanderer)
        {
            foreach (Microbe microbe in SpawnBacteriaColony(species, location, worldNode, microbeScene,
                                                            cloudSystem, CurrentGame, random))
            {
                yield return(microbe);
            }
        }
    }
示例#5
0
    void Start()
    {
        _thisEnemy = SpawnerBehaviour.AllSpawned[gameObject];
        _dpsMeter  = HUDBehaviour.Instance.DpsMeter;

        if (_thisEnemy is IFighter fighter)
        {
            fighter.DagameReceived += damage => _dpsMeter.CurrentFight.AddDamage(damage);
        }

        if (_thisEnemy is ISkilled skilled)
        {
            foreach (var skill in skilled.Skills)
            {
                skill.OnSuccessUsed += Skill_OnSuccessUsed;
            }
        }
    }
示例#6
0
    // Needs no params constructor for loading saves?

    /// <summary>
    ///   Adds an externally spawned entity to be despawned
    /// </summary>
    public static void AddEntityToTrack(ISpawned entity,
                                        float radius = Constants.MICROBE_SPAWN_RADIUS)
    {
        entity.DespawnRadiusSqr = (int)(radius * radius);
        entity.SpawnedNode.AddToGroup(Constants.SPAWNED_GROUP);
    }
示例#7
0
 public static void AddSpawned(GameObject gameObject, ISpawned spawned)
 {
     _allSpawned.Add(gameObject, spawned);
 }
示例#8
0
 /// <summary>
 ///   Add the entity to the spawned group and add the despawn radius
 /// </summary>
 private void ProcessSpawnedEntity(ISpawned entity)
 {
     entity.DespawnRadius = Constants.DESPAWN_ITEM_RADIUS;
     entity.SpawnedNode.AddToGroup(Constants.SPAWNED_GROUP);
 }
示例#9
0
 /// <summary>
 /// Sets Despawn radius and adds entity to SPAWNED_GROUP
 /// </summary>
 public static void AddEntityToTrack(ISpawned entity)
 {
     entity.DespawnRadius = Constants.DESPAWN_ITEM_RADIUS;
     entity.SpawnedNode.AddToGroup(Constants.SPAWNED_GROUP);
 }