Example #1
0
 public void eject()
 {
     displayBunny = null;
     gene = null;
     cable.DNA = null;
     renderer.material.color = new Color(1,1,1,renderer.material.color.a);
     button.pressed = false;
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     if(basis == null) {
         basis = gameObject.GetComponent<testGene>();
     }
     basis.genes[0].T1=true;
     basis.genes[0].trait1=.5f;
     basis.genes[0].T2=false;
     basis.genes[0].trait2=.5f;
 }
Example #3
0
 //NOW UNUSED
 public static testDNA Create(string newName, testGene P1, testGene P2)
 {
     testDNA newDNA = GameObject.CreatePrimitive (PrimitiveType.Sphere).AddComponent<testDNA> ();
     //newDNA.renderer.
     //newDNA = GameObject.CreatePrimitive(PrimitiveType.Cube).AddComponent<bunny_behavior>();
     newDNA.name = newName;
     newDNA.P1 = P1;
     newDNA.P2 = P2;
     newDNA.DoExpressionFlow ();
     return newDNA;
 }
Example #4
0
    // put bunny in -> press button -> it grabs the gene information
    void OnTriggerStay(Collider target)
    {
        // Push out anything when a bunny is inside already
        if (displayBunny != null && target.rigidbody != null && target != displayBunny && !target.rigidbody.isKinematic) {
            target.rigidbody.velocity = -5f * (transform.position - target.transform.position);
        }
        // Add bunny when button pressed and the target inside is a bunny (in the inventory, being displayed, or wild)
        if ((target.tag == "inventory" || target.tag == "wild" || target.tag == "display") && displayBunny == null && button.pressed) {
            displayBunny = target.gameObject;
            DNA = target.GetComponent<testDNA>();
            gene = DNA.actual;
            renderer.material.color = new Color(DNA.express [4], DNA.express [1], DNA.express [2], renderer.material.color.a);
            displayBunny.tag = "display";
            cable.DNA = DNA;
            button.pressed = false;

        }
        if(button.pressed == false){
            if(target.tag == "display"){
                target.tag = "wild";
            }
        }
    }
Example #5
0
    void Update()
    {
        // If the button is pressed, but there is already a bunny inside, eject the bunny and set the color back to the default
        if (button.pressed == true && displayBunny != null) {
            eject();
        }

        // BUNNY!
        if (displayBunny != null) {
            if(DNA == null){
                DNA = displayBunny.GetComponent<testDNA>();
                gene = DNA.actual;
                cable.DNA = DNA;
            }
            displayBunny.transform.position = Vector3.Lerp(displayBunny.transform.position, transform.position, .5f);
            displayBunny.transform.Rotate (new Vector3 (0f, 1f, 0f));
        }
    }
Example #6
0
 // Use this for initialization
 void Awake()
 {
     if (basis == null) {
         basis = new GameObject (name + "_Basis").AddComponent<testGene> ();
     }
     actual = (testGene)Instantiate (basis);
     actual.InitGenes ();
     if (P1 != null && P2 != null) {
         DoExpressionFlow ();
     }
 }