void Strategy_RandomShoot() { if (isCompletingStrategy == false) { randomLookDirection = AIHelper.GetRandomVector(); } Vector3 curDir = planetManager.rocketDirection; Vector3 newDir; float curAngle = Vector3.SignedAngle(curDir, randomLookDirection, Vector3.forward); if (curAngle > deltaDegree) { newDir = Quaternion.Euler(-Time.deltaTime * 100, -Time.deltaTime * 100, -Time.deltaTime * 100) * curDir; planetManager.Command_SetRocketRotation(newDir + transform.position); } if (curAngle < -deltaDegree) { newDir = Quaternion.Euler(-Time.deltaTime * 100, -Time.deltaTime * 100, -Time.deltaTime * 100) * curDir; planetManager.Command_SetRocketRotation(newDir + transform.position); } WaitAndShoot(); }
void Update() { //Ignore commands if it's on HUD if (MouseOvereGui(Input.mousePosition)) { return; } //Virtual mouse WorldSpace position Vector3 virtWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); //Rocket Direction has changed planetManager.Command_SetRocketRotation(virtWorldPos); //Shoot Requested if (Input.GetMouseButtonDown(0)) { planetManager.Command_Shoot(); } }