Пример #1
0
        void Update()
        {
            if (!_paintEditorEnabled)
            {
                Debug.Log("Paint Editor Disabled");
                return;
            }

            if (Input.GetKeyDown(KeyCode.LeftShift))
            {
                EntityManager.AddComponentData(_entity, new ExplodeView {
                    Duration = ExplodeDuration, Easing = ExplodeEasing
                });
            }
            else if (Input.GetKeyUp(KeyCode.LeftShift))
            {
                EntityManager.AddComponentData(_entity, new ImplodeView {
                    Duration = ImplodeDuration, Easing = ImplodeEasing
                });
            }
            else if (Input.GetKeyDown(KeyCode.LeftControl))
            {
                viewIndex++;
                if (viewIndex >= _positions.Length)
                {
                    viewIndex = 0;
                }

//
//                if (viewIndex == 0)
//                {
//                    EntityManager.AddComponentData(_entity, new CameraController{Active = true, Offset = new float3(width/2,height/2, -width)});
//                }else if (EntityManager.HasComponent<CameraController>(_entity))
//                {
//                    EntityManager.RemoveComponent<CameraController>(_entity);
//                }

//                Debug.Log("viewIndex="+viewIndex);
                SequenceBuilder
                .FromEntity(_entity)
                .MoveView(0.15f, MoveDuration, MoveEasing,
                          _positions[viewIndex],
                          quaternion.identity,
                          new float3(1, 1, 1)
                          )
                .RestoreParent()
                .Build();
            }
        }
Пример #2
0
        void Update()
        {
            if (Input.GetKey(KeyCode.Space))
            {
                transform.Rotate(math.up(), 500f * Time.deltaTime);
                EntityManager.SetComponentData(_entity, new Rotation {
                    Value = transform.rotation
                });
            }
            if (serged)
            {
//                if (!Input.GetKey(KeyCode.LeftShift))
//                {
//                    serged = false;
////                    EntityManager.SetComponentData(_parentId);
//                    EntityManager.AddComponentData(_entity, new RestoreParentView
//                    {
//                        Position = new float3(32,32,0)
//                    });
////                    for (int x = 0; x < width; x++)
////                    {
////                        for (int y = 0; y < height; y++)
////                        {
////                            EntityManager.SetComponentData(_cubes[x,y], _parentId);
////                        }
////                    }
//                }
            }
            else if (Input.GetKeyDown(KeyCode.LeftShift))
            {
//                serged = true;

//                Debug.Log("Lorne : " + EntityManager.GetComponentData<ParentId>(_cubes[0,0]).Value);

//                for (int x = 0; x < width; x++)
//                {
//                    for (int y = 0; y < height; y++)
//                    {
//                        EntityManager.SetComponentData(_cubes[x,y], new ParentId{Value = 0});
//                    }
//                }
                _newPosition = new Vector3(
                    Random.Range(-100, 100),
                    0,//Random.Range(-100, 100),
                    Random.Range(50, 200));

//Explode();

                var sequence = SequenceBuilder.FromEntity(_entity);

//                sequence.Explode(0, 1);

                for (int i = 0; i < 100; i++)
                {
                    _newPosition = new Vector3(
                        Random.Range(-50, 100),
                        Random.Range(-50, 100),
                        Random.Range(50, 100));

                    sequence
//                        .Explode(0f, 1.55f)
                    .MoveView(0, 1.0f, Easing.Linear,
                              _newPosition,
                              quaternion.Euler(0, 0, 0),
                              new float3(1, 1, 1)
                              )
                    .RestoreParent(0.05f, 0.05f, _newPosition);
//                        .Implode(0f, 0.15f);

//                    sequence
//                        .Explode(0, 0.3f)
//                        .Implode(0, 0.3f)
//                        .Explode(0, 0.3f);
                }

                sequence.Explode(0, 2.3f)
                .Implode(0, 1.0f)
                .Explode(0, 1.0f)
                .Implode(0, 1.0f)
                .Explode(0, 1.0f)
                .Implode(0, 0.5f)
                .Explode(0, 0.5f)
                .Implode(0, 0.5f)
                .Explode(0, 0.5f)
                .Implode(0, 0.5f)
                .Explode(0, 0.5f)
                .Implode(0, 0.5f)
                .Explode(0, 0.5f).Implode(0, 0.5f)
                .Explode(0, 0.5f)
                .Implode(0, 0.5f)
                .Explode(0, 0.5f)
                .Implode(0, 0.5f)
                .Explode(0, 0.5f)
                .Implode(0, 0.5f)
                .Explode(0, 0.5f)
                .Implode(0, 2.3f)
                .Explode(0, 2.3f)
                .Implode(0, 2.3f)
                .Explode(0, 2.3f)
                .Implode(0, 2.3f)
                .Explode(0, 2.3f)
                .Implode(0, 2.3f)
                .Explode(0, 2.3f)
                .Implode(0, 2.3f)    //    .Build();
                .MoveView(5.3f, 1.0f, Easing.StrongOut,
                          _newPosition,
                          quaternion.Euler(0, 0, 0),
                          new float3(1, 1, 1)
                          )
                .RestoreParent(0.1f, 0.1f, _newPosition)
                .Implode(0.3f, 1.0f)
                .Build();

//  Explode();
//                Invoke("Explode", Random.Range(0, 3));
//                Explode();
            }

//            if (Input.GetKeyDown(KeyCode.LeftShift))
//            {
//                rotationSpeed = Random.Range(-500, 500);
//            }
//            transform.Rotate(math.up(), rotationSpeed * Time.deltaTime);
//            EntityManager.SetComponentData(_entity, new Rotation
//            {
//                Value = transform.rotation
//            });
//            EntityManager.SetComponentData(_entity, new Position
//            {
//                Value = transform.position
//            });
//            EntityManager.SetComponentData(_entity, new Scale
//            {
//                Value = transform.localScale
//            });
        }