Ejemplo n.º 1
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        currentCooldown -= Time.deltaTime;

        var job = new PositionJob
        {
            CDPercentage = currentCooldown / totalCooldown
        };

        if (currentCooldown <= 0)
        {
            currentCooldown = totalCooldown;
            //NativeArray<Entity> allEntities = EntityManager.GetAllEntities(Allocator.TempJob);
            int step = (int)MicrobeSpawner.total / 500;
            for (int i = 0; i < MicrobeSpawner.total; i += step)
            {
                //Entity e = EntityManager.CreateEntity(EnemySpawner._cellArchetype);

                Debug.LogError("there is " + MicrobeSpawner.total + " and index is " + i);
                MicrobeSpawner.SpawnEntity(
                    EntityManager.GetComponentData <Position>(MicrobeSpawner.entityArray[i]).Value +
                    MicrobeSpawner.ReturnRandomPositionOffset(1f), MicrobeSpawner.EntityType.Antibody);

                //if (EntityManager.HasComponent<MitosisData>(e))
                //{
                //    EntityManager.SetComponentData(e, new Position() {Value = EntityManager.GetComponentData<Position>(allEntities[i]).Value});
                //}
            }
        }
        return(job.Schedule(this, inputDeps));
    }
Ejemplo n.º 2
0
    /// <summary>
    ///   Spawns the player if there isn't currently a player node existing
    /// </summary>
    public void SpawnPlayer()
    {
        if (Player != null)
        {
            return;
        }

        Player = MicrobeSpawner.Spawn(GameWorld.PlayerSpecies, new Vector3(0, 0, 0),
                                      rootOfDynamicallySpawned, MicrobeSpawner.LoadMicrobeScene(), false, Clouds,
                                      CurrentGame);
        Player.AddToGroup("player");

        Player.OnDeath = OnPlayerDied;

        Player.OnReproductionStatus = OnPlayerReproductionStatusChanged;

        Camera.ObjectToFollow = Player;

        if (spawnedPlayer)
        {
            // Random location on respawn
            var random = new Random();
            Player.Translation = new Vector3(
                random.Next(Constants.MIN_SPAWN_DISTANCE, Constants.MAX_SPAWN_DISTANCE), 0,
                random.Next(Constants.MIN_SPAWN_DISTANCE, Constants.MAX_SPAWN_DISTANCE));

            spawner.RespawningPlayer();
        }

        TutorialState.SendEvent(TutorialEventType.MicrobePlayerSpawned, new MicrobeEventArgs(Player), this);

        spawnedPlayer      = true;
        playerRespawnTimer = Constants.PLAYER_RESPAWN_TIME;
    }
Ejemplo n.º 3
0
    public PatchManager(SpawnSystem spawnSystem, ProcessSystem processSystem,
                        CompoundCloudSystem compoundCloudSystem, TimedLifeSystem timedLife,
                        DirectionalLight worldLight, GameProperties currentGame)
    {
        this.spawnSystem         = spawnSystem;
        this.processSystem       = processSystem;
        this.compoundCloudSystem = compoundCloudSystem;
        this.timedLife           = timedLife;
        this.worldLight          = worldLight;

        CloudSpawner   = new CompoundCloudSpawner(compoundCloudSystem);
        ChunkSpawner   = new ChunkSpawner(compoundCloudSystem);
        MicrobeSpawner = new MicrobeSpawner(compoundCloudSystem, currentGame);
    }
Ejemplo n.º 4
0
    void Update()
    {
        /*
         * Vector3 mouseDiff = lastmouse - Input.mousePosition;
         * transform.position -= new Vector3(-mouseDiff.x/2 + mouseDiff.x, 0, -mouseDiff.y / 2 + mouseDiff.y) * 0.1f;
         * lastmouse = Input.mousePosition;
         */

        transform.position += new Vector3(Input.GetAxis("RHorizontal"), 0, Input.GetAxis("RVertical")) * Time.deltaTime * speedMult;

        if (Input.GetButton("Fire2"))
        {
            for (int i = 0; i < 7; i++)
            {
                MicrobeSpawner.SpawnEntity(transform.position, MicrobeSpawner.EntityType.Antibody);
            }
        }
    }
Ejemplo n.º 5
0
 public override IEnumerable <ISpawned> Spawn()
 {
     return(MicrobeSpawner.Spawn(WorldNode, Position, species, IsWanderer));
 }
Ejemplo n.º 6
0
 public MicrobeItem(MicrobeSpecies species, MicrobeSpawner microbeSpawner)
 {
     this.species   = species;
     MicrobeSpawner = microbeSpawner;
 }