示例#1
0
 protected void Start()
 {
     if (mutationName != "" && this.gameObject.GetComponent<Mutations>() != null) { //If you levae a mutationName empty it will not account for it, so use this if you want non-tranferable mutations
         if (!this.gameObject.GetComponent<Mutations>().mutations.Contains(mutationName)) {
             this.gameObject.GetComponent<Mutations>().mutations.Add(mutationName); //adds mutation to this bacteria's current list of mutations
         }
         List<string> wedge;
     }
     stats = this.gameObject.GetComponent<Stats> ();
     MutationInstance = null;
     if (MutationObject != null) {
         MutationInstance =(GameObject)Instantiate (MutationObject);
         Vector3 ang = transform.eulerAngles; //holds current rotation for simple no-math solution
         Vector3 scale = transform.localScale;
         transform.localScale = Vector3.one;
         transform.eulerAngles = Vector3.zero;
         MutationInstance.transform.position = new Vector3(transform.position.x + MutationInstance.transform.position.x,transform.position.y + MutationInstance.transform.position.y,transform.position.z + MutationInstance.transform.position.z);
         MutationInstance.transform.SetParent(this.gameObject.transform); //attaches the new mutation to its owner
         transform.eulerAngles = ang;
         transform.localScale = scale;
     }
     //all set changes for mutations from public input are made onto the cell's stats
     stats.maxHealth += maxHealth;
     stats.metabolism += metabolism;
     stats.maturation += maturation;
     stats.reproductionEfficiency += reproductionEfficiency;
     stats.aggression += aggression;
     stats.herbivorism += herbivorism;
     stats.carnivoreism += carnivoreism;
     stats.sightRadius += sightRadius;
     stats.damage += damage;
     stats.speed += speed;
     stats.healing += healing;
     stats.notifyInitialized(this);
 }