private BoxGizmo CreateEntityGizmo(EntityData entityData) { YHDebug.LogFormat("create gizmo {0}", entityData.id); if (entityData.id <= 0) //|| entityData.beltId != 0 { return(null); } BoxGizmo gizmo = null; ItemProto itemProto2 = LDB.items.Select(entityData.protoId); Vector3 position = entityData.pos; float num = itemProto2.prefabDesc.buildCollider.ext.magnitude * 0.7f; if (entityData.inserterId == 0) { gizmo = BoxGizmo.Create(entityData.pos, entityData.rot, itemProto2.prefabDesc.selectCenter, itemProto2.prefabDesc.selectSize); } else { ColliderData colliderData2 = player.planetData.physics.GetColliderData(entityData.colliderId); colliderData2.ext.x += 0.1f; gizmo = BoxGizmo.Create(colliderData2.pos, colliderData2.q, Vector3.zero, colliderData2.ext * 2f); } gizmo.multiplier = 1f; gizmo.alphaMultiplier = itemProto2.prefabDesc.selectAlpha; gizmo.fadeInScale = 1.3f; gizmo.fadeInTime = 0.05f; gizmo.fadeInFalloff = 0.5f; gizmo.fadeOutScale = 1.3f; gizmo.fadeOutTime = 0.05f; gizmo.fadeOutFalloff = 0.5f; gizmo.color = Color.white; return(gizmo); }
private void UpdateBuildPreviewsPosition(Vector3 mousePos) { YHDebug.LogFormat("UpdateBuildPreviewsPosition:mouse pos :{0}", mousePos); Vector3 groundPos = Vector3.zero; if (m_FactoryBP.TryScreenPositionToGroundPosition(mousePos, ref groundPos)) { YHDebug.LogFormat("UpdateBuildPreviewsPosition:ground pos :{0}", groundPos); m_FactoryBP.UpdateBuildPosition(groundPos); } }
public override void EscLogic() { YHDebug.LogFormat("bp create esc logic {0}", controller.cmd.mode); bool num = !VFInput._godModeMechaMove; bool flag = VFInput.rtsCancel.onDown || VFInput.escKey.onDown || VFInput.escape || VFInput._buildModeKey.onDown; bool flag2 = !VFInput.onGUI && VFInput.inScreen; if (num && flag && flag2) { VFInput.UseBuildKey(); VFInput.UseEscape(); VFInput.UseRtsCancel(); TrarckPlugin.Instance.isBPCreate = false; _Close(); } }
public void CreateAction() { if (VFInput._buildConfirm.onDown && m_SelectEntities.Count > 0) { YHDebug.LogFormat("Create bp {0}", m_SelectEntities.Count); if (GameMain.localPlanet != null) { //过滤 List <EntityData> filterEntities = FilterEntitis(m_SelectEntities); YHDebug.LogFormat("Create bp after filter {0}", filterEntities.Count); //排序 by entity id filterEntities.Sort(SortEntityDataCompare); List <EntityData> sortedEntities = filterEntities; CreateBluePrint(sortedEntities); } m_SelectEntities.Clear(); } }