public static void Export() { SettingsImport asset = CreateInstance <SettingsImport> (); SerializedObject tagManager = GetTagManager(); SerializedProperty tags = tagManager.FindProperty("tags"); asset.tags = new string[tags.arraySize]; for (int i = 0; i < tags.arraySize; ++i) { asset.tags[i] = tags.GetArrayElementAtIndex(i).stringValue; } for (int i = 8; i < 32; ++i) { asset.layers[i - 8] = tagManager.FindProperty(kUserLayerPrefix + i).stringValue; } asset.axes = InputInterface.GetAxes(); string path = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(asset)); Debug.Log(path); path = path.Substring(0, path.LastIndexOf('/')) + "/SettingsExport.asset"; AssetDatabase.CreateAsset(asset, path); Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(path); }
public SolverManager() { FG = 0; _timestamp = DateTime.Now.ToFileTime(); _logger = new Logger(); #if !DEBUG _logger.Init(".\\app_" + _timestamp + ".log"); #endif _logger.Log(JsonConvert.SerializeObject(SolverConfig.GetInstance())); int asyncLearners = SolverConfig.GetInstance().async_learners; _actorMonitor = new Dictionary <int, int>(); _inputInterface = new InputInterface(); _encoder = new StateEncoder(_inputInterface); _agent = new AsyncQN(asyncLearners); _learners = new AsyncSolver[asyncLearners]; for (int i = 0; i < asyncLearners; i++) { IExploration exp = null; exp = new BoltzmannExploration(SolverConfig.GetInstance().epsilon, 0.13f); exp.Init(0.13f); //exp = new EGreedyExploration(SolverConfig.GetInstance().epsilon, 0f); //exp.Init(0.05f, 0f); _learners[i] = new AsyncSolver(_inputInterface, _encoder, _agent, exp, _logger); } }
public Logger() { LoggingConfiguration conf = new LoggingConfiguration(); this.InputLogger = new Input(); try { Console.Title = "MineNET"; Console.CancelKeyPress += ConsoleOnCancelKeyPress; conf.AddTarget("console", new MineNetSimpleConsoleTarget { Layout = new SimpleLayout( "[${longdate}] [${threadname} /${uppercase:${level:padding=5}}] ${message}") }); conf.AddRule(LogLevel.Debug, LogLevel.Fatal, "console"); } catch (IOException) { } this.SetLogFileConfig(conf); LogManager.Configuration = conf; this.OutputLogger = LogManager.GetCurrentClassLogger(); }
public static void Release() { if (inputDevice != null) { inputDevice.Release(); inputDevice = null; } }
Communication() { #if DEBUG input = new Testing.TestingInputs(); #else // input = new RealControls(); #endif }
/// <summary> /// Calculates a LineSegment from the camera's position to the /// 3D position of the cursor, as if it were on the camera's farplane. /// </summary> public void CalculateCursorLineSegment(out LineSegment segment) { segment.start = Vector3.Zero; segment.end = Vector3.Zero; if (null == this.renderCamera) { return; } // Get position from Input Interface InputInterface input = this.game.SceneManager.GetInterface(InterfaceType.Input) as InputInterface; if (null == input) { throw new Exception("Input interface was not initialized before call to CalculateCursorRay()"); } CursorInfo info = input.GetCursorInfo(); if (!info.IsVisible) { // Cursor is not visible, so we just bail return; } // create 2 positions in screenspace using the cursor position. 0 is as // close as possible to the camera, 1 is as far away as possible. Vector3 nearSource = new Vector3(info.Position, 0f); Vector3 farSource = new Vector3(info.Position, 1f); MsgGetViewport msgGetPort = ObjectPool.Aquire <MsgGetViewport>(); this.game.SendInterfaceMessage(msgGetPort, InterfaceType.Graphics); MsgGetProjectionMatrix msgGetProj = ObjectPool.Aquire <MsgGetProjectionMatrix>(); msgGetProj.UniqueTarget = renderCamera.UniqueID; this.game.SendMessage(msgGetProj); MsgGetViewMatrix msgGetView = ObjectPool.Aquire <MsgGetViewMatrix>(); msgGetView.UniqueTarget = renderCamera.UniqueID; this.game.SendMessage(msgGetView); Viewport vPort = msgGetPort.Data; Matrix projMat = msgGetProj.Data; Matrix viewMat = msgGetView.Data; // use Viewport.Unproject to tell what those two screen space positions // would be in world space. we'll need the projection matrix and view // matrix, which we have saved as member variables. We also need a world // matrix, which can just be identity. segment.start = vPort.Unproject(nearSource, projMat, viewMat, Matrix.Identity); segment.end = vPort.Unproject(farSource, projMat, viewMat, Matrix.Identity); }
public Solver(InputInterface p_inputInterface, StateEncoder p_encoder, BaseAgent p_agent, IExploration p_exp, Logger p_logger) { _inputInterface = p_inputInterface; _encoder = p_encoder; _agent = p_agent; _exploration = p_exp; _logger = p_logger; _gameState = new StateVar(); _histogram = new Dictionary <int, int>(); }
public void MoveShip(InputInterface i) { if (i._right) { _rot += 6.0f; } else if (i._left) { _rot -= 6.0f; } }
public void getCurrentInput() { //left joystick or wasd Moveh = InputInterface.GetAxisRaw("Horizontal"); Movev = InputInterface.GetAxisRaw("Vertical"); //right joystick or arrow keys Lookh = InputInterface.GetAxisRaw("HorizontalLook"); Lookv = InputInterface.GetAxisRaw("VerticalLook"); //space or right trigger f = InputInterface.GetAxisRaw("Fire1"); }
public void SetBinding(InputInterface.KeyBinding binding, bool initialSet) { if (initialSet) { Awake(); } this.keyBinding = binding; string bindingName = UFUtils.Capitalize(binding.name); this.text.text = bindingName + " : " + InputInterface.GetKeyName(binding.code); Global.input.SetBinding(binding, initialSet); }
public void map(Button button) { if (button.Pressed && !previousPressed) { InputInterface.PressKey(keyCode); } if (!button.Pressed && previousPressed) { InputInterface.ReleaseKey(keyCode); } update(button); }
public void map(Trigger trigger) { var pressedStatus = getPressedStatus(trigger.Movement); int x = 0; for (int i = 0; i < pressedStatus.Length; ++i) { if (previousPressed[i] && !pressedStatus[i]) { if (i == 0) { x = 1; InputInterface.SendMouseClick(InputInterface.MOUSEEVENTF.RIGHTUP); } else { if (i == 1) { x = 2; InputInterface.SendMouseClick(InputInterface.MOUSEEVENTF.LEFTUP); } } } if (!previousPressed[i] && pressedStatus[i]) { if (i == 0) { x = 3; //System.Windows.Forms.MessageBox.Show("ClickRight"); InputInterface.SendMouseClick(InputInterface.MOUSEEVENTF.RIGHTDOWN); } else { if (i == 1) { x = 4; InputInterface.SendMouseClick(InputInterface.MOUSEEVENTF.LEFTDOWN); } } } } update(pressedStatus); //if(x != 0) // System.Windows.Forms.MessageBox.Show("" + x); }
// Update is called once per frame void Update() { //calls a method that gets our current input getCurrentInput(); //send our inputs to the playercontroller if (Mathf.Abs(Moveh) != 0 || Mathf.Abs(Movev) != 0) { anim.SetFloat("Blend", 1, 0.1f, Time.deltaTime); sendInput.updatePosition(Moveh, Movev); } else { sendInput.notUpdatingPosition(); anim.SetFloat("Blend", 0, 0.1f, Time.deltaTime); } //update player direction if (Mathf.Abs(Lookh) != 0 || Mathf.Abs(Lookv) != 0) { sendInput.updateDirection(Lookh, Lookv); } else { sendInput.notUpdatingDirection(); } //gets if we are firing if (Mathf.Abs(f) != 0) { sendInput.fire(); } if (InputInterface.GetAxisRaw("Grenade") != 0) { UsePowerUp(2); } if (InputInterface.GetAxisRaw("Armor") != 0) { UsePowerUp(0); } if (InputInterface.GetAxisRaw("SpeedBoost") != 0) { UsePowerUp(1); } if (InputInterface.GetAxisRaw("Nuke") != 0) { UsePowerUp(3); } }
private void Start() { if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { //input = new InputPC(); } else { //input = GetComponentInChildren<InputVR>(); } input = GetComponentInChildren <InputVR>(); if (input == null) { Debug.Log("InputNulo"); } }
public void map(AnalogStick stick) { var currentDirectionStatus = getDirectionStatus(stick); var releasedDirections = getReleasedDirections(currentDirectionStatus); var pressedDirections = getPressedDirections(currentDirectionStatus); //s += "Release:\t"; //foreach (bool b in releasedDirections) //{ // s += b + "\t"; //} //s += "\n"; //s += "Pressed:\t"; //foreach (bool b in pressedDirections) //{ // s += b + "\t"; //} //s += "\n"; for (int i = 0; i < releasedDirections.Length; ++i) { //string t = " "; if (releasedDirections[i] == true) { InputInterface.ReleaseKey((short)directionsToKeys[(Direction)i]); //t = "rel"; } //s += t + "\t"; } //s += "\n"; for (int i = 0; i < pressedDirections.Length; ++i) { //string t = " "; if (pressedDirections[i] == true) { InputInterface.PressKey((short)directionsToKeys[(Direction)i]); // t = "prs"; } //s += t + "\t"; } update(currentDirectionStatus); }
//TODO: Aktion beim Klick variabel maachen public void map(AnalogStick stick) { var m = getMouseMovement(stick); InputInterface.MoveMouse(m[0], m[1]); if (stick.Clicked && !previousClicked) { InputInterface.SendMouseClick(InputInterface.MOUSEEVENTF.LEFTDOWN); } if (!stick.Clicked && previousClicked) { InputInterface.SendMouseClick(InputInterface.MOUSEEVENTF.LEFTUP); } update(stick); }
public void Setup(InputData inputData, Sprite barrelSprite, Sprite baseSprite, Sprite ballSprite) { InputData = inputData; BallSprite = ballSprite; if (InputData.InputControllerType == InputControllerType.KeyboardMouse) { InputInterface = new KeyboardMouseInputInterface(); } else if (InputData.InputControllerType == InputControllerType.Gamepad) { InputInterface = new GamepadInputInterface(InputData.GamepadNumber); } transform.Find("Barrel/Sprite").GetComponent <SpriteRenderer>().sprite = barrelSprite; transform.Find("Base").GetComponent <SpriteRenderer>().sprite = baseSprite; transform.Find("Base/Canvas/Name").GetComponent <Text>().text = inputData.GetName(); }
public static void Initialization() { XmlDocument doc = GameRoot.gameResource.LoadResource_PublicXmlFile("GameOptions.xml"); XmlNode root = doc.SelectSingleNode("GameOptions"); XmlNode node = root.SelectSingleNode("GameInputMode"); string workMode = node.Attribute("mode"); currentInputMode = InputInterface.InputModeStringToMode(workMode); inputDevice = InputInterface.AllocInputInterface(currentInputMode); if (inputDevice == null) { throw new Exception("unknow input device!"); } inputDevice.Initialization(); InputDevice.AutoSleepTime_Player[0] = UniGameOptionsDefine.AutoSleepTime; InputDevice.AutoSleepTime_Player[1] = UniGameOptionsDefine.AutoSleepTime; }
public Experiment1() { SolverConfig.GetInstance().Load(@".\config.json"); _timestamp = DateTime.Now.ToFileTime(); _logger = new Logger(); #if !DEBUG _logger.Init(".\\app_" + _timestamp + ".log"); #endif _logger.Log(JsonConvert.SerializeObject(SolverConfig.GetInstance())); int asyncLearners = SolverConfig.GetInstance().async_learners; _inputInterface = new InputInterface(); _encoder = new StateEncoder(_inputInterface); _agent = new DDQN(); IExploration exp = new EGreedyExploration(SolverConfig.GetInstance().epsilon, 0f); exp.Init(0.1f, 1f); _solver = new Solver(_inputInterface, _encoder, _agent, exp, _logger); }
public static InputInterface MakeDefault() { Debug.LogWarning("Made default Input interface object. Please include this object in a " + "static (DontDestroyOnLoad) manner to be able to change user input."); GameObject g = new GameObject("DefaultInputInterface"); InputInterface ii = g.AddComponent <InputInterface>(); ii.bindings = new KeyBinding[] { new KeyBinding("Fire", KeyCode.Mouse0), new KeyBinding("AltFire", KeyCode.Mouse1), new KeyBinding("left", KeyCode.A), new KeyBinding("right", KeyCode.D), new KeyBinding("forward", KeyCode.W), new KeyBinding("backward", KeyCode.S), new KeyBinding("jump", KeyCode.Space), new KeyBinding("crouch", KeyCode.LeftShift), new KeyBinding("escape", KeyCode.Escape) }; return(ii); }
void Start() { mRigidbody = gameObject.GetComponent <Rigidbody>(); //wheelGeometry = transform.FindChild("wheelGeometry"); if (gameObject.GetComponent <FixedJoint>() != null) { axisRigidBody = gameObject.GetComponent <FixedJoint>().connectedBody; } else if (gameObject.GetComponent <HingeJoint>() != null) { axisRigidBody = gameObject.GetComponent <HingeJoint>().connectedBody; } body = axisRigidBody.GetComponent <ConfigurableJoint>().connectedBody; restHeight = body.transform.InverseTransformPoint(transform.position).y; lastHeight = restHeight; // Get user input object input = transform.parent.gameObject.GetComponent <InputInterface>(); meanWeightSupported = transform.parent.gameObject.GetComponent <Rigidbody>().mass *Physics.gravity.y / 4.0f; }
void Start() { //gear thresholds gearThresholds = new float[7][]; gearThresholds[1] = new float[2]; gearThresholds[1][0] = 500; gearThresholds[1][1] = 1000; gearThresholds[2] = new float[2]; gearThresholds[2][0] = 1000; gearThresholds[2][1] = 2000; gearThresholds[3] = new float[2]; gearThresholds[3][0] = 2000; gearThresholds[3][1] = 3000; gearThresholds[4] = new float[2]; gearThresholds[4][0] = 3000; gearThresholds[4][1] = 4000; gearThresholds[5] = new float[2]; gearThresholds[5][0] = 4000; gearThresholds[5][1] = 4600; gearThresholds[6] = new float[2]; gearThresholds[6][0] = 4600; gearThresholds[6][1] = 7000; // Get user input object input = transform.parent.gameObject.GetComponent <InputInterface>(); // Set centerOfMass mRigidbody = gameObject.GetComponent <Rigidbody>(); centerOfMass = transform.parent.FindChild("CenterOfMass").localPosition; mRigidbody.centerOfMass = centerOfMass; // Find all car parts FrontAxisRight = transform.parent.FindChild("FrontAxisRight"); RearAxisRight = transform.parent.FindChild("RearAxisRight"); frontLeftWheel = transform.parent.FindChild("FrontLeftWheel").GetComponent <PhysicsWheel>(); frontRightWheel = transform.parent.FindChild("FrontRightWheel").GetComponent <PhysicsWheel>(); backLeftWheel = transform.parent.FindChild("BackLeftWheel").GetComponent <PhysicsWheel>(); backRightWheel = transform.parent.FindChild("BackRightWheel").GetComponent <PhysicsWheel>(); frontLeftWheel.wheelAnimator = transform.FindChild("l_frontWheel_system").GetComponent <Animator>(); frontRightWheel.wheelAnimator = transform.FindChild("r_frontWheel_system").GetComponent <Animator>(); backLeftWheel.wheelAnimator = transform.FindChild("l_backWheel_system").GetComponent <Animator>(); backRightWheel.wheelAnimator = transform.FindChild("r_backWheel_system").GetComponent <Animator>(); //frontLeftWheel.steeringBone = transform.FindChild("l_frontWheel_system").FindChild("joint2"); //frontRightWheel.steeringBone = transform.FindChild("r_frontWheel_system").FindChild("joint2"); frontLeftWheel.steeringBone = leftSteeringBone; frontRightWheel.steeringBone = rightSteeringBone; //frontLeftWheel.wheelGeometry = transform.FindChild("l_frontWheel_system").transform.FindChild("wheelGeometry"); //frontRightWheel.wheelGeometry = transform.FindChild("r_frontWheel_system").transform.FindChild("wheelGeometry"); //backLeftWheel.wheelGeometry = transform.FindChild("l_backWheel_system").transform.FindChild("wheelGeometry"); //backRightWheel.wheelGeometry = transform.FindChild("r_backWheel_system").transform.FindChild("wheelGeometry"); frontLeftWheel.wheelGeometry = frontLeftWheelGeometry; frontRightWheel.wheelGeometry = frontRightWheelGeometry; frontRightWheel.scaleX = -1; backLeftWheel.wheelGeometry = backLeftWheelGeometry; backRightWheel.wheelGeometry = backRightWheelGeometry; distanceBetweenWheels = (transform.parent.FindChild("FrontLeftWheel").position - transform.parent.FindChild("FrontRightWheel").position).magnitude; currentGear = 1; // first gear }
public static void Import(bool manual = false) { Object[] assets = Resources.FindObjectsOfTypeAll(typeof(SettingsImport)); if (assets.Length < 1) { if (manual) { Debug.LogError("Did not find a settings export asset for importing"); } return; } SettingsImport asset = (SettingsImport)assets[0]; SerializedObject tagManager = GetTagManager(); Debug.Log("Importing settings...", asset); SerializedProperty tags = tagManager.FindProperty("tags"); for (int i = 0; i < asset.tags.Length; ++i) { if (i > tags.arraySize - 1) { tags.InsertArrayElementAtIndex(i); SerializedProperty userTag = tags.GetArrayElementAtIndex(i); userTag.stringValue = asset.tags[i]; } else { SerializedProperty userTag = tags.GetArrayElementAtIndex(i); if (asset.Collision(userTag.stringValue, asset.tags[i], "Tag", manual)) { tagManager.ApplyModifiedProperties(); return; } userTag.stringValue = asset.tags[i]; } } for (int i = 0; i < asset.layers.Length; ++i) { SerializedProperty userLayer = tagManager.FindProperty(kUserLayerPrefix + (i + 8)); if (asset.Collision(userLayer.stringValue, asset.layers[i], "Layer", manual)) { tagManager.ApplyModifiedProperties(); return; } userLayer.stringValue = asset.layers[i]; } List <AxisDefinition> axes = InputInterface.GetAxes(); foreach (AxisDefinition axis in asset.axes) { if (axes.Contains(axis)) { continue; } AxisDefinition collision = axes.Where(other => axis.InterfaceEquals(other)).FirstOrDefault(); if (collision != null) { InputInterface.SaveAxis(axis, axes.IndexOf(collision)); axes = InputInterface.GetAxes(); continue; } InputInterface.AddAxis(axis); axes = InputInterface.GetAxes(); } tagManager.ApplyModifiedProperties(); }
public void AddReceiver(InputInterface inputReceiver) { Receivers.Add(inputReceiver); }
public AsyncSolver(InputInterface p_inputInterface, StateEncoder p_encoder, BaseAgent p_agent, IExploration p_exp, Logger p_logger) : base(p_inputInterface, p_encoder, p_agent, p_exp, p_logger) { }
internal void AddController(InputInterface controller) { Control = controller; }
internal void AddController(InputInterface controller) { Control = controller; }
void Start() { mRigidbody = gameObject.GetComponent<Rigidbody>(); //wheelGeometry = transform.FindChild("wheelGeometry"); if (gameObject.GetComponent<FixedJoint>() != null) { axisRigidBody = gameObject.GetComponent<FixedJoint>().connectedBody; } else if (gameObject.GetComponent<HingeJoint>() != null) { axisRigidBody = gameObject.GetComponent<HingeJoint>().connectedBody; } body = axisRigidBody.GetComponent<ConfigurableJoint>().connectedBody; restHeight = body.transform.InverseTransformPoint(transform.position).y; lastHeight = restHeight; // Get user input object input = transform.parent.gameObject.GetComponent<InputInterface>(); meanWeightSupported = transform.parent.gameObject.GetComponent<Rigidbody>().mass * Physics.gravity.y / 4.0f; }
public StateEncoder(InputInterface p_inputInterface) { _inputInterface = p_inputInterface; _itemProjection = new Dictionary <string, int>(); _cellProjection = new Dictionary <string, int>(); }
void Start() { //gear thresholds gearThresholds = new float[7][]; gearThresholds[1] = new float[2]; gearThresholds[1][0] = 500; gearThresholds[1][1] = 1000; gearThresholds[2] = new float[2]; gearThresholds[2][0] = 1000; gearThresholds[2][1] = 2000; gearThresholds[3] = new float[2]; gearThresholds[3][0] = 2000; gearThresholds[3][1] = 3000; gearThresholds[4] = new float[2]; gearThresholds[4][0] = 3000; gearThresholds[4][1] = 4000; gearThresholds[5] = new float[2]; gearThresholds[5][0] = 4000; gearThresholds[5][1] = 4600; gearThresholds[6] = new float[2]; gearThresholds[6][0] = 4600; gearThresholds[6][1] = 7000; // Get user input object input = transform.parent.gameObject.GetComponent<InputInterface>(); // Set centerOfMass mRigidbody = gameObject.GetComponent<Rigidbody>(); centerOfMass = transform.parent.FindChild("CenterOfMass").localPosition; mRigidbody.centerOfMass = centerOfMass; // Find all car parts FrontAxisRight = transform.parent.FindChild("FrontAxisRight"); RearAxisRight = transform.parent.FindChild("RearAxisRight"); frontLeftWheel = transform.parent.FindChild("FrontLeftWheel").GetComponent<PhysicsWheel>(); frontRightWheel = transform.parent.FindChild("FrontRightWheel").GetComponent<PhysicsWheel>(); backLeftWheel = transform.parent.FindChild("BackLeftWheel").GetComponent<PhysicsWheel>(); backRightWheel = transform.parent.FindChild("BackRightWheel").GetComponent<PhysicsWheel>(); frontLeftWheel.wheelAnimator = transform.FindChild("l_frontWheel_system").GetComponent<Animator>(); frontRightWheel.wheelAnimator = transform.FindChild("r_frontWheel_system").GetComponent<Animator>(); backLeftWheel.wheelAnimator = transform.FindChild("l_backWheel_system").GetComponent<Animator>(); backRightWheel.wheelAnimator = transform.FindChild("r_backWheel_system").GetComponent<Animator>(); //frontLeftWheel.steeringBone = transform.FindChild("l_frontWheel_system").FindChild("joint2"); //frontRightWheel.steeringBone = transform.FindChild("r_frontWheel_system").FindChild("joint2"); frontLeftWheel.steeringBone = leftSteeringBone; frontRightWheel.steeringBone = rightSteeringBone; //frontLeftWheel.wheelGeometry = transform.FindChild("l_frontWheel_system").transform.FindChild("wheelGeometry"); //frontRightWheel.wheelGeometry = transform.FindChild("r_frontWheel_system").transform.FindChild("wheelGeometry"); //backLeftWheel.wheelGeometry = transform.FindChild("l_backWheel_system").transform.FindChild("wheelGeometry"); //backRightWheel.wheelGeometry = transform.FindChild("r_backWheel_system").transform.FindChild("wheelGeometry"); frontLeftWheel.wheelGeometry = frontLeftWheelGeometry; frontRightWheel.wheelGeometry = frontRightWheelGeometry; frontRightWheel.scaleX = -1; backLeftWheel.wheelGeometry = backLeftWheelGeometry; backRightWheel.wheelGeometry = backRightWheelGeometry; distanceBetweenWheels = (transform.parent.FindChild("FrontLeftWheel").position - transform.parent.FindChild("FrontRightWheel").position).magnitude; currentGear = 1; // first gear }
public void SetInputInterface (InputInterface input) { this.input = input; }
// Start is called before the first frame update void Start() { m_Controller = GetComponent <CharacterController>(); m_Anim = GetComponentInChildren <Animator>(); m_InputInterface = GetComponent <InputInterface>(); }
public void Tick(InputInterface ii, Rectangle screen) { _rotation = (ii.Left ? -4f : 0) + (ii.Right ? 4f : 0); _boosting = ii.Up; if (ii.Shoot && cycleNum == 0) { cycleNum++; _shooting = true; Console.WriteLine("shooting"); } else if (ii.Shoot && cycleNum <= _shootTimer) { cycleNum++; _shooting = false; Console.WriteLine("trying to shoot"); } else if (cycleNum > _shootTimer || !ii.Shoot) { cycleNum = 0; _shooting = false; Console.WriteLine("Gave up / reset"); } if (ii.Up) { _vel = 8f; } else if (_vel > 0) { _vel -= (_vel * 0.05f); } if (_pos.X < screen.Width && _pos.X > 0) { _pos.X += -(float)Math.Sin((_currentRot * Math.PI) / 180) * _vel; } else if (_pos.X > screen.Width) { _pos.X = _pos.X - 2; } else { _pos.X = _pos.X + 2; } if (_pos.Y < screen.Height && _pos.Y > 0) { _pos.Y += (float)Math.Cos((_currentRot * Math.PI) / 180) * _vel; } else if (_pos.Y > screen.Height) { _pos.Y = _pos.Y - 2; } else { _pos.Y = _pos.Y + 2; } if (_currentRot >= 360 || _currentRot <= -360) { _currentRot = 0; } else { _currentRot += _rotation; } if (_alpha < 254) { _alpha += 2; } else if (_alpha == 254) { _alpha++; } }
// Start is called before the first frame update void Start() { m_Input = GetComponent <InputInterface>(); }