Esempio n. 1
0
    /*
     * public static GalaxyTransform NetworkTransform(this Transform transform)
     * {
     *  GalaxyTransform  galaxyTransform = new GalaxyTransform();
     *  galaxyTransform.position = new GalaxyVector3();
     *  galaxyTransform.position = transform.position.NetworkVector3();
     *  galaxyTransform.rotation = new GalaxyQuaternion();
     *  galaxyTransform.rotation = transform.rotation.NetworkQuaternion();
     *  return galaxyTransform;
     * }
     */


    public static Vector3 Vector3(this GalaxyVector3 vector)
    {
        tmp.x = vector.x;
        tmp.y = vector.y;
        tmp.z = vector.z;
        return(tmp);
    }
Esempio n. 2
0
 public override void Update()
 {
     if (GalaxyVector3.Distance(transform.position, player.transform.position) < 2)
     {
         return;
     }
     GalaxyVector3.LerpOptimize(transform.position, player.transform.position, instance.Time.deltaTime * 0.7f);
 }
Esempio n. 3
0
    public static GalaxyVector3 NetworkVector3(this Vector3 vector3)
    {
        GalaxyVector3 mes = new GalaxyVector3();

        mes.x = vector3.x;
        mes.y = vector3.y;
        mes.z = vector3.z;
        return(mes);
    }
Esempio n. 4
0
    public static Vector3 Vector3(this GalaxyVector3 vector)
    {
        Vector3 mes = new Vector3();

        mes.x = vector.x;
        mes.y = vector.y;
        mes.z = vector.z;
        return(mes);
    }
Esempio n. 5
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);   // лерпим текущую позицию к целевой раз в кадр
 }
Esempio n. 6
0
 public override void Update()
 {
     physics.ApplyPhys();
     distanse = GalaxyVector3.Distance(room.forseTarget, transform.position);
     if (distanse > 20)
     {
         physics.AddForсe((room.forseTarget - transform.position) * 2f);
     }
     else
     {
         physics.AddForсe((transform.position - room.forseTarget) * 6f);
     }
 }
 /// <summary>
 /// пример использования рейкаста (проверяем достает ли луч до игрока)
 /// </summary>
 private void RayTest()
 {
     directional = player.transform.position - startPoint;
     physics.RayCast(startPoint, directional, out RaycastHit raycastHit);
     debug.transform.position = raycastHit.point;
     if (raycastHit.entity == player)
     {
         player.SendRayCastResult(true);
         Log.Info("Distanse", raycastHit.Distanse().ToString());
     }
     else
     {
         player.SendRayCastResult(false);
         Log.Info("Tag: ", raycastHit.tag);
     }
 }
        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();
        }
 public ExamplePhysCapsule(Instance instance, GalaxyVector3 position = null, GalaxyQuaternion rotation = null, NetEntityAutoSync syncType = NetEntityAutoSync.position_and_rotation) : base(instance, position, rotation, syncType)
 {
     prefabName = "ExampleCapsule";
 }
Esempio n. 10
0
 public ExamplePhysBox(Instance instance, GalaxyVector3 position = null, GalaxyQuaternion rotation = null, NetEntityAutoSync syncType = NetEntityAutoSync.position_and_rotation) : base(instance, position, rotation, syncType)
 {
     //Задаем имя префаба соответствующего данному объекту
     prefabName = "ExampleBox";
 }
Esempio n. 11
0
        private int randTime;                               // время ожидания шага


        public ExampleRandomMove(Instance instance, GalaxyVector3 position = null, GalaxyQuaternion rotation = null, NetEntityAutoSync syncType = NetEntityAutoSync.position_and_rotation) : base(instance, position, rotation, syncType)
        {
            prefabName = "Move"; // задаем имя, что бы клиент знал какой префаб отображать
        }
Esempio n. 12
0
 public static void Vector3(this GalaxyVector3 vector, out Vector3 vector3)
 {
     vector3.x = vector.x;
     vector3.y = vector.y;
     vector3.z = vector.z;
 }