Example #1
0
 public override void Update()
 {
     timer += instance.Time.deltaTime;
     if (timer > randTime)
     {
         timer    = 0;
         randTime = GRand.NextInt(10, 25);
         target.x = GRand.NextInt(-80, 80);
         target.z = GRand.NextInt(-80, 80);
     }
     GalaxyVector3.LerpOptimize(transform.position, target, instance.Time.deltaTime * 0.04f);   // лерпим текущую позицию к целевой раз в кадр
 }
        public override void Update()
        {
            timer += Time.deltaTime;

            if (timer > 0.2f)
            {
                timer = 0;
                if (bodyCount < bodyMax)
                {
                    BoxSpawn();
                }
                if (bodyForseCount < bodyForseMax)
                {
                    BodyForseSpawn();
                }
            }

            frameCount++;
            if (frameCount % 300 == 0)
            {
                forseTarget = new GalaxyVector3(GRand.NextInt(0, 100), GRand.NextInt(0, 100), GRand.NextInt(0, 100));
            }

            if (player == null)
            {
                player = (ExamplePlayer)entities.list.Where(x => x.prefabName == "Player").FirstOrDefault();
                if (player != null)
                {
                    debug = new NetEntitys.ExamplePlayer(this);
                    debug.Init();
                    debug.physics.Deactivate();
                }
                return;
            }
            RayTest();
        }
 private void BodyForseSpawn()
 {
     Examples.NetEntitys.ExampleForse entity = new Examples.NetEntitys.ExampleForse(this, new GalaxyVector3(GRand.NextInt(5, 10), GRand.NextInt(5, 10), GRand.NextInt(5, 10)), new GalaxyQuaternion(0, 0, 0, 0));
     entity.room = this;
     entity.Init();
     bodyForseCount++;
 }