示例#1
0
    private void Start()
    {
        var count = (int)ETestShape3D.EnumCount;

        for (int i = 0; i < count; i++)
        {
            for (int j = 0; j < count; j++)
            {
                LVector3 pos    = new LVector3(true, (i * gridGap), (j * gridGap), 0);
                var      shape1 = CreateShape(i, (i * count + j) * 2,
                                              pos.ToVector3());
                var shape2 = CreateShape(j, (i * count + j) * 2 + 1,
                                         (pos + new LVector3(true, moveDist, 0f, 0f)).ToVector3());
                allPairs.Add(new DebugUnityColliderProxy[2] {
                    shape1, shape2
                });
                StartCoroutine(
                    PingPongMove(shape1, shape1.transform.position.ToLVector3(),
                                 pos + new LVector3(true, moveDist, moveDist, 0f), rawMoveTime));
                StartCoroutine(
                    PingPongMove(shape2, shape2.transform.position.ToLVector3(),
                                 pos + new LVector3(true, 0f, moveDist, 0f), rawMoveTime));
            }
        }
    }
示例#2
0
        public static GameObject CreateEntity(BaseEntity entity, int prefabId, LVector3 position, GameObject prefab, object config)
        {
            var obj = GameObject.Instantiate(prefab, position.ToVector3(), Quaternion.identity);

            entity.engineTransform = obj.transform;
            entity.transform.Pos3  = position;
            config.CopyFiledsTo(entity);
            var views = obj.GetComponents <IView>();

            foreach (var view in views)
            {
                view.BindEntity(entity);
            }
            entity.prefabID = prefabId;
            entity.DoAwake();
            entity.DoStart();
            return(obj);
        }
        public static GameObject CreateEntity(BaseEntity entity, int prefabId, LVector3 position, GameObject prefab,
                                              object config)
        {
            var obj = (GameObject)GameObject.Instantiate(prefab, position.ToVector3(), Quaternion.identity);

            entity.engineTransform = obj.transform;
            entity.transform.Pos3  = position;
            config.CopyFiledsTo(entity);
            entity.animator = obj.GetComponent <CAnimation>();
            var views = obj.GetComponents <IView>();

            foreach (var view in views)
            {
                view.BindEntity(entity);
            }

            entity.PrefabId = prefabId;
            GameManager.Instance.collisionManager.RegisterEntity(prefab, obj, entity);
            entity.DoAwake();
            entity.DoStart();
            return(obj);
        }
 public void TakeDamage(int amount, LVector3 hitPoint)
 {
     enemyAudio.Play();
     hitParticles.transform.position = hitPoint.ToVector3();
     hitParticles.Play();
 }
 public static LVector2 Vector3Field(string label, LVector3 value, params GUILayoutOption[] options)
 {
     return(EditorGUILayout.Vector3Field(label, value.ToVector3(), options).ToLVector3());
 }
示例#6
0
 public override void OnTakeDamage(int amount, LVector3 hitPoint)
 {
     uiFloatBar.UpdateHp(entity.curHealth, entity.maxHealth);
     FloatTextManager.CreateFloatText(hitPoint.ToVector3(), -amount);
 }
示例#7
0
 public void SetPosition(LVector3 val)
 {
     transform.position = val.ToVector3();
     OnSetPosition(new LVector2(val.x, val.y));
 }
 public virtual void OnTakeDamage(int amount, LVector3 hitPoint)
 {
     FloatTextManager.CreateFloatText(hitPoint.ToVector3(), -amount);
 }
示例#9
0
 public void DrawLine(LVector3 a, LVector3 b)
 {
     Gizmos.DrawLine(a.ToVector3(), b.ToVector3());
 }