Exemple #1
0
    private void SpawnTutorialVirus(Vector2 spawnPos)
    {
        Organism virus = Virus.InstantiateVirus(spawnPos);

        virus.GetComponent <OrganismAttack>().enabled   = false;
        virus.GetComponent <OrganismMovement>().enabled = false;
    }
Exemple #2
0
    private void SpawnTutorialBacteriaCell(Vector2 spawnPos)
    {
        Organism bacteriaCell = BacteriaCell.InstantiateBacteriaCell(spawnPos);

        bacteriaCell.GetComponent <OrganismAttack>().enabled      = false;
        bacteriaCell.GetComponent <OrganismMovement>().enabled    = false;
        bacteriaCell.GetComponent <OrganismDuplication>().enabled = false;
        bacteriaCell.GetComponent <OrganismMutation>().enabled    = false;

        bacteriaCellList.Add(bacteriaCell);
    }
    public static void SetDrag(Organism organism)
    {
        float angularDragMultiplier = 0.3f;

        if (organism.transform.childCount == 0)
        {
            organism.GetComponent <Rigidbody2D>().angularDrag = 0.3f;
            return;
        }

        Bounds bounds = organism.transform.GetChild(0).GetComponent <Collider2D>().bounds;

        for (int i = 1; i < organism.transform.childCount; i++)
        {
            Collider2D collider = organism.transform.GetChild(i).GetComponent <Collider2D>();

            bounds.Encapsulate(collider.bounds);
        }
        organism.GetComponent <Rigidbody2D>().angularDrag = bounds.extents.magnitude * angularDragMultiplier;
    }
Exemple #4
0
    //Generate organisms "DNA" and other attributes
    private Organism SetupOrganism(Organism organism)
    {
        organism.Waypoints            = waypoints;
        organism.DestinationThreshold = simManager.destinationThreshold;
        organism.MoveSpeed            = simManager.moveSpeed;
        organism.WanderWaitTime       = simManager.wanderWaitTime;

        organism.Generation = currentGeneration;
        organism.Id         = PopGen.MakeId(currentGeneration, currentSize);
        organism.name       = PopGen.MakeOrganismName();
        organism.DNA        = PopGen.MakeOrganismDNA();

        Renderer rend = organism.GetComponent <Renderer>();

        rend.material       = new Material(Shader.Find("Standard"));
        rend.material.color = PopGen.ColorAlleleToColor(organism.DNA["color"]);

        organism.Fitness = PopGen.EvaluateFitness("color", organism.DNA["color"]);
        organism.Parents = new string[] { "?????-?????", "?????-?????" };
        return(organism);
    }
Exemple #5
0
 private void SpawnTutorialHumanCell(Vector2 spawnPos)
 {
     humanCell = HumanCell.InstantiateHumanCell(spawnPos);
     humanCell.GetComponent <OrganismDuplication>().enabled = false;
 }