void Update() { if (Singleton <GameManager> .Instance.gameState != GameManager.GameState.Play) { return; } if (!Singleton <StageStart> .Instance.IsEnd) { return; } if (Singleton <ClearChecker> .Instance.IsClear) { return; } if (Singleton <StageState> .Instance.NowStageState == StageState.StageStateEnum.Rotate) { if (ic.A) { if (selectObject == null) { return; } RotatePoint r = selectObject.GetComponent <RotatePoint>(); if (r != null) { selectObject.GetComponent <RotatePoint>().BeginRotate(); } } } }
/// <summary> /// 计算可旋转地图的旋转点 /// </summary> /// <param name="map"></param> /// <param name="mapCreatePoint"></param> /// <returns></returns> private Vector3 CalRotatePoint(JsonData map) { if (mapType == MapType.Normal) { return(mapMgr.mapCreatePoint.position); } RotatePoint rotatePoint = (RotatePoint)Enum.Parse(typeof(RotatePoint), (string)map["RotatePoint"]); if (rotatePoint == RotatePoint.Start) { return(mapMgr.mapCreatePoint.position); } //mapCreatePoint是引用类型,操作之后要改成初始状态 Vector3 startPos = mapMgr.mapCreatePoint.position; Vector3 startAngle = mapMgr.mapCreatePoint.eulerAngles; bool startIsLeft = mapMgr.isLeft; float startTime = mapMgr.mapTime; JsonData mapItems = map["Tiles"]; foreach (JsonData mapItem in mapItems) { TileType tileType = (TileType)Enum.Parse(typeof(TileType), (string)mapItem["TileType"]); float time = (float)(double)mapItem["Time"]; ChangeMapCreatePoint(tileType); Vector3 targetPos = mapMgr.mapCreatePoint.position + mapMgr.mapCreatePoint.forward * (time - mapMgr.mapTime) * mapMgr.speed; mapMgr.mapTime = time; mapMgr.mapCreatePoint.position = targetPos; } Vector3 endPos = mapMgr.mapCreatePoint.position; //mapCreatePoint是引用类型,操作之后要改成初始状态 mapMgr.mapCreatePoint.position = startPos; mapMgr.mapCreatePoint.eulerAngles = startAngle; mapMgr.isLeft = startIsLeft; mapMgr.mapTime = startTime; if (rotatePoint == RotatePoint.Middle) { return(startPos + (endPos - startPos) / 2); } Debug.LogWarning("没有处理该rotatePoint的方法"); return(Vector3.zero); }
public IModule3D CreateModule() { if (transformerType == TransformerType.Turbulence) { Turbulence turbulence = new Turbulence(); turbulence.Power = power; } else if (transformerType == TransformerType.RotatePoint) { RotatePoint rotatePoint = new RotatePoint(); RotatePoint rotatePoint2 = rotatePoint; Vector2f rotation = this.rotation; rotatePoint2.XAngle = rotation.x; RotatePoint rotatePoint3 = rotatePoint; Vector2f rotation2 = this.rotation; rotatePoint3.YAngle = rotation2.y; rotatePoint.ZAngle = 0f; return(rotatePoint); } return(new Displace()); }
public void SetSouces(IModule3D target, IModule3D sourceModule, IModule3D xModule, IModule3D yModule, IModule3D zModule) { if (transformerType == TransformerType.Turbulence) { Turbulence turbulence = target as Turbulence; turbulence.SourceModule = sourceModule; turbulence.XDistortModule = xModule; turbulence.YDistortModule = yModule; turbulence.ZDistortModule = zModule; } else if (transformerType == TransformerType.RotatePoint) { RotatePoint rotatePoint = target as RotatePoint; rotatePoint.SourceModule = sourceModule; } else { Displace displace = target as Displace; displace.SourceModule = sourceModule; displace.XDisplaceModule = xModule; displace.YDisplaceModule = yModule; displace.ZDisplaceModule = zModule; } }
public static void CreateTestModuleTree(TestContext context) { var baseWood = new Cylinders { Frequency = 16, }; var woodGrainNoise = new Perlin { Seed = 2135, Frequency = 48, Persistence = 0.5, Lacunarity = 2.20703125, OctaveCount = 3, Quality = NoiseQuality.Standard, }; var scaledBaseWoodGrain = new ScalePoint { Source0 = woodGrainNoise, YScale = 0.25, }; var woodGrain = new ScaleBias { Source0 = scaledBaseWoodGrain, Scale = 0.25, Bias = 0.125, }; var combinedWood = new Add { Source0 = baseWood, Source1 = woodGrain, }; var perturbedWood = new Turbulence { Source0 = combinedWood, Seed = 1, Frequency = 4, Power = 1.0 / 256.0, Roughness = 4, }; var translatedWood = new TranslatePoint { Source0 = perturbedWood, ZTranslation = 1.48, }; var rotatedWood = new RotatePoint { Source0 = translatedWood, }; rotatedWood.SetAngles(84, 0, 0); var finalWood = new Turbulence { Source0 = rotatedWood, Seed = 2, Frequency = 2, Power = 1.0 / 64.0, Roughness = 4, }; testModule = finalWood; }
public void SetSelectObject(RotatePoint point) { rp = point; }
bool EvaluateRotatePoint(RotatePoint point) { return point.IsDrawn; }
private void DrawRotatePoint(RotatePoint rp) { }
void Start() { originPoint = lineOrigin.GetComponent<RotatePoint>(); }