示例#1
0
    // Use this for initialization
    void Awake()
    {
        if (vStatus != null) Destroy(this.gameObject);
        else vStatus = this;

        var villagers = FindObjectsOfType<CharMotor>();
        foreach (var v in villagers)
        {
            if (v.gameObject.layer == LayerMask.NameToLayer("villager"))
            {
                villagerCount++;
            }
        }

        text = GetComponent<Text>();
    }
示例#2
0
    // Use this for initialization
    void Awake()
    {
        if (vStatus != null)
        {
            Destroy(this.gameObject);
        }
        else
        {
            vStatus = this;
        }

        var villagers = FindObjectsOfType <CharMotor>();

        foreach (var v in villagers)
        {
            if (v.gameObject.layer == LayerMask.NameToLayer("villager"))
            {
                villagerCount++;
            }
        }

        text = GetComponent <Text>();
    }
示例#3
0
 public Village(VillageStartup startup, ServerCallContext context)
 {
     _context = context;
     _startup = startup;
     _year    = 346;
     _month   = 1;
     _status  = new VillageStatus
     {
         Time    = "",
         People  = _startup.People,
         Message = ""
     };
     _villagers = new List <Villager>();
     for (int i = 0; i < startup.People; i++)
     {
         _villagers.Add(new Villager
         {
             IsMale     = _r.Next(1) == 1,
             IsPregnant = false,
             Age        = _r.Next(30),
             MonthBorn  = _r.Next(1, 12)
         });
     }
 }