Ejemplo n.º 1
0
 private void updatePregnancy()
 {
     if (mPregnant == true && mGender == GameTypes.GenderType.Female)
     {
         //Debug.Log("processing pregnancy");
         if (mPregnancyProgress >= 100)
         {
             //reset pregnancy
             mPregnant          = false;
             mPregnancyProgress = 0f;
             //make new unit instance with random gender
             GameTypes.GenderType[] genders = new[] { GameTypes.GenderType.Female, GameTypes.GenderType.Male };
             GameTypes.GenderType   gender  = genders[mRandomGen.Next(genders.Length)];
             //gender is always the same, so change the generator
             int  temp = mRandomGen.Next(0, 10);
             Unit unit = ObjectManager.initUnit(transform.position, gender, mTown);
             //send new units to the main hut, so the user knows they are new
             unit.waitAt(mTown.mMainBuilding);
         }
         else
         {
             mPregnancyProgress += Globals.UNIT_PREGNANCY_CYCLE_PROGRESS;
         }
     }
 }
Ejemplo n.º 2
0
        //init unit functions
        public static Unit initUnit(Vector3 pos, GameTypes.GenderType gender, Town town)
        {
            Unit unit = GameObject.Instantiate(getUnit("Unit"), town.gameObject.transform).GetComponent <Unit>();

            unit.setGender(gender);
            unit.gameObject.transform.position = pos;
            town.addEntity("units", unit);
            return(unit);
        }
Ejemplo n.º 3
0
 public void setGender(GameTypes.GenderType gender)
 {
     mGender = gender;
 }
Ejemplo n.º 4
0
 private void getActer()
 {
     mActer       = GetComponentInParent <Unit>();
     mActerGender = mActer.getGender();
 }