/// <summary> /// Gets the type of baby /// </summary> /// <returns>the baby type as a string </returns> public string GetChildType() { string childType = ""; if (this.culebraObject is BabyCreeper) { this.babyCreeper = (BabyCreeper)this.culebraObject; childType = this.babyCreeper.GetBabyCreeperObject().getType(); } return(childType); }
/// <summary> /// Getter for retrieving the objectType uses the java getClass().getName() method /// </summary> /// <returns>the object type specified from java getClass().getName() method</returns> public string GetObjType() { string objType = ""; if (this.culebraObject is BabyCreeper) { this.babyCreeper = (BabyCreeper)this.culebraObject; this.culebraObject.GetObject().behavior.setObjType(this.babyCreeper.GetBabyCreeperObject().getObjectType()); objType = this.babyCreeper.GetBabyCreeperObject().getObjectType(); } else { objType = this.culebraObject.GetObject().getObjectType(); } return(objType); }
/// <summary> /// Gets the superclass of the object /// </summary> /// <returns>the superclass as string</returns> public string GetSuperClass() { string superclass = ""; if (this.culebraObject is BabyCreeper) { this.babyCreeper = (BabyCreeper)this.culebraObject; this.culebraObject.GetObject().behavior.setSuperClass(this.babyCreeper.GetBabyCreeperObject().getSuperClass()); superclass = this.babyCreeper.GetBabyCreeperObject().getSuperClass(); } else { superclass = this.culebraObject.GetObject().getSuperClass(); } return(superclass); }
/// <summary> /// Spawns the creeper child objects /// </summary> /// <param name="dimensions">If we are in 2D or 3D</param> /// <param name="creepList">The list of culebra objects to add the children to</param> private void SpawnChild(int dimensions, List <CulebraObject> creepList) { Random rnd = new Random(); int babyCount = 0; foreach (Vector3d px in this.childSpawners) { Vector3d speed; if (dimensions == 0) { speed = new Vector3d(rnd.Next(-2, 2) * 0.5, rnd.Next(-2, 2) * 0.5, 0); } else { speed = new Vector3d(rnd.Next(-2, 2) * 0.5, rnd.Next(-2, 2) * 0.5, rnd.Next(-2, 2) * 0.5); } Creeper a; bool three_d = new bool(); if (dimensions == 0) { three_d = false; } else { three_d = true; } if (this.childSpawnType[babyCount] % 2 == 0) { a = new BabyCreeper(new Vector3d(px.X, px.Y, px.Z), speed, false, "a", three_d); creepList.Add(a); } else { a = new BabyCreeper(new Vector3d(px.X, px.Y, px.Z), speed, false, "b", three_d); creepList.Add(a); } babyCount++; } }