protected override void OnUpdate() { float deltaTime = Time.DeltaTime; bool test = true; GooCubeGrid cubeGrid = GooCubeGrid.Instance; Entities .WithAll <PurpleGooTweenData, PurpleGooCubeData>() .ForEach((ref PurpleGooTweenData tweenData, in PurpleGooCubeData cubeData) => { float deltaPosition = cubeData.height - tweenData.visual_height; if (deltaPosition * deltaPosition < 1) { return; } else if (!cubeData.active) { deltaPosition = -200f; } // if (deltaPosition > 0) { // tweenData.visual_height -= deltaPosition * deltaTime; // } else { tweenData.visual_height += deltaPosition * deltaTime * 0.8f; // } tweenData.visual_height = Mathf.Clamp(tweenData.visual_height, -1f, GooHeightSystem.MAX_CUBE_HEIGHT); if (test && cubeData.active) { test = false; Debug.Log("Tween " + tweenData.visual_height + " cubeData " + cubeData.height + " delta " + deltaPosition); } }).WithoutBurst().Run(); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
protected override void OnUpdate() { EntityCommandBuffer commandBuffer = new EntityCommandBuffer(Allocator.TempJob); GooCubeGrid grid = GooCubeGrid.Instance; Entities.WithAll <Translation, GooBombData>().WithNone <DeleteEntityTag>().ForEach((Entity entity, in Translation translation, in GooBombData bombData) => { if (!bombData.hitGround) { return; } commandBuffer.AddComponent <DeleteEntityTag>(entity); grid.Explode(translation.Value.x, translation.Value.z, bombData.bombSize); }).WithoutBurst().Run();
protected override void OnUpdate() { GooCubeGrid cubeGrid = GooCubeGrid.Instance; Entities .WithAll <PurpleGooCubeData>() .ForEach((ref PurpleGooCubeData cubeData) => { cubeData.height = cubeGrid.GetCubeHeight( cubeData.gridIndex.x, cubeData.gridIndex.z ); }).WithoutBurst().Run(); }
protected override void OnUpdate() { GooCubeGrid cubeGrid = GooCubeGrid.Instance; Entities .WithAll <PurpleGooCubeData>() .WithNone <InactiveGooCubeTag>() .ForEach((ref PurpleGooCubeData cubeData) => { cubeGrid.SetCubeHeight( cubeData.gridIndex.x, cubeData.gridIndex.z, cubeGrid.GetCubeHeight(cubeData.gridIndex.x, cubeData.gridIndex.z) - cubeData.pendingDamage ); cubeData.pendingDamage = 0; }).WithoutBurst().Run(); }