Ejemplo n.º 1
0
 void RandWeather(float prop = 0.2f)
 {
     if (Data.Count <= TotalCount)
     {
         if (RandUtil.Rand(prop))
         {
             Spawn(WeatherType.Rand <WorldWeatherType>(), new Vector2(RandUtil.RandInt(0, RealCount), RandUtil.RandInt(0, RealCount)));
         }
     }
 }
Ejemplo n.º 2
0
        public void Spawn(WorldWeatherType type, Vector2 index)
        {
            if (Data.ContainsKey(index.ToString()))
            {
                return;
            }
            if (index.x >= RealCount || index.y >= RealCount)
            {
                return;
            }
            if (!ConfigData.ContainsKey(type))
            {
                return;
            }
            Vector2 pos     = PosIndex[(int)index.x, (int)index.y];
            Vector3 realPos = new Vector3(pos.x, BaseSceneObject.GetAbsHeight(pos.x, pos.y), pos.y);

            realPos.x += RandUtil.RandFloat(-50, 50);
            realPos.z += RandUtil.RandFloat(-50, 50);
            var perform = PerfomMgr.Spawn(ConfigData[type].Rand(), realPos, Quaternion.identity);

            Data.Add(index.ToString(), new WorldWeatherData(RandUtil.RandInt(50, 400), perform));
        }
Ejemplo n.º 3
0
 protected override void StopMove()
 {
     base.StopMove();
     _animator.CrossFade("Idle" + RandUtil.RandInt(0, 4), 0.1f, 0, RandUtil.Range(0.0f, 0.9f));
 }
Ejemplo n.º 4
0
        //随意枚举的值,枚举的序号必须从0开始
        public static T Rand <T>(this Type enumType)
        {
            Array temp = Enum.GetValues(enumType);

            return((T)temp.GetValue(RandUtil.RandInt(0, temp.Length)));
        }
Ejemplo n.º 5
0
 protected override void StopMove()
 {
     base.StopMove();
     _animator.CrossFade("idle" + RandUtil.RandInt(0, 2), 0.1f);
 }