void CreatePlatform(float positionY, Vector2 normal) { var platformData = new PlatformData(30, normal); simulator.AddPlatform(platformData); platformData.SetPositionX(0); platformData.SetPositionY(positionY); var platformObject = new GameObject("Platform"); var platformController = platformObject.AddComponent <Platform>(); platformController.SetData(platformData); platforms.Add(platformData); }
void Update() { var deltaX = mouse.DeltaX; if (deltaX > 0 || deltaX < 0) { var lastPosition = data.GetPosition(); data.SetPositionX(lastPosition.x + deltaX); data.SetSpeed(new Vector2(deltaX / Time.deltaTime, 0)); UpdatePosition(); } else { data.SetSpeed(Vector2.zero); } }