private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Circle" || collision.tag == "DoubleCircle") { circleController = collision.gameObject.GetComponentInChildren <CircleController>(); } if (collision.tag == "ColorSwitch") { RandomColor(); Destroy(collision.gameObject); } else if (collision.tag == "Star") { Score++; Write(); CreateLevel(); circleController.PlayStarAudio(); Destroy(collision.gameObject); } else if (collision.tag == "Dead Layer") { Dead(); } else if (collision.tag != CurrentColor && collision.tag != "Circle" && collision.tag != "DoubleCircle") { Dead(); } }
void Awake() { col2D = GetComponent <PolygonCollider2D>(); triggerDetector = GetComponent <TriggerDetector>(); GameManager.Instance.gameStateChangeEvent += (GameManager.State gameState) => { switch (gameState) { case GameManager.State.Playing: ResetArrow(); break; } }; arrowCrashed += () => { GameManager.Instance.GameState = GameManager.State.Failed; CameraController.Instance.ShakeCamera(); SoundManager.Instance.PlayCrush(); circle = null; col2D.enabled = false; rb.velocity = Vector2.zero; GetComponent <Renderer>().enabled = false; transform.FindChild("ArrowShadow").GetComponent <Renderer>().enabled = false; }; }
private void startEndAnimaition() { mCurEndImgShowTime = 0; mState = STATE_END; if (mIsClicked) { CircleController circleController = circles[0].GetComponent <CircleController>(); mClearImageController.startAnimaition(circles[0].transform.position, circleController.getColor32()); } else { // right case //int onePerson = Random.Range(0, touches.Count); // wrong case int onePerson = Random.Range(0, touches.Count - 1); touchlocation thisTouch = touches[onePerson]; foreach (touchlocation tl in touches) { if (tl == thisTouch) { continue; } tl.dismissCircle(); } mClearImageController.startAnimaition(thisTouch.getPos(), thisTouch.getColor32()); } }
void UpdateLogic() { if (!(hasInput && roundPlaying)) { return; } int mask = LayerMask.GetMask("Character"); Collider2D tmp = Physics2D.OverlapPoint(inputPos, mask, 0); if (tmp == null) { return; } CircleController target = tmp.gameObject.GetComponent <CircleController>(); bool isInRange = AreaController.OverlapCircle(target); if (isInRange) { UpdateMC(target); // Update scoring here ScoreText.text = "Score: " + _roundNumber.ToString(); SpawnNewRound(); } }
public void ScoreChecker(int score, int lifes) // this is called when we replay a game with another life { if (ScoreManager.instance.getLifes() <= 0) { // the gameOver() function it is called from the circleController if this variable it's true GameObject.FindWithTag("circleController").GetComponent <CircleController> ().setGameOverTrue(); } else if (ScoreManager.instance.getLifes() > 0) { gameStartedFromMenu = false; gameReplayed = true; this.score = score; this.lifes = lifes; this.timer = CircleController.getTimer(); /*// activate transparent hearts if you have less than 3 lifes * switch (lifes) { * case 1: * UIManager.instance.getAnimht2 ().SetBool ("minusLife", true); * goto case 2; * case 2 : * UIManager.instance.getAnimht1 ().SetBool ("minusLife", true); * break; * } */ // Reload GAME UIManager.instance.replayWithAnotherLife(); // we take all the data from the other classes when the game is over or it will be restarted so it can be perpetuated to a new life change in the game } }
public void Initialize(CircleController controller, Color color, int segments, float radius, float startAngle, float segmentAngle) { Color = color; circleController = controller; _radius = radius; if (!image) { image = GetComponent <Image>(); } if (!collider) { collider = GetComponent <EdgeCollider2D>(); } if (!rigidBody) { rigidBody = GetComponent <Rigidbody2D>(); } if (!rectTransform) { rectTransform = GetComponent <RectTransform>(); } image.color = color; rectTransform.sizeDelta = new Vector2(radius * 2, radius * 2); UpdateSegment(segments, startAngle, segmentAngle); }
private void showCircle(GameObject go, Vector3 pos) { CircleController controller = go.GetComponentInChildren <CircleController>(); controller.initCircle(); moveCircle(go, pos); go.SetActive(true); SoundManager.sInstance.playOneShot(AudioClipManager.sinstance.AC_GEM_GET); }
private void Cache() { app = App.Instance; triangleController = app.controller.triangle; circleController = app.controller.circle; bulletController = app.controller.bullet; barrierController = app.controller.barrier; uiController = app.controller.ui; }
// Update is called once per frame void Update() { if (!circleControllerReference.getGameOverState()) { scoreText.text = ScoreManager.instance.getScore().ToString(); float t = CircleController.getTimer(); timerText.text = t > 0 ? (t >= 10 ? ((int)t).ToString() : "0" + (int)t) : "00"; } }
// Use this for initialization void Start() { Init(); MC = SpawnCircle(Vector3.zero); Enemies = new List <CircleController>(); UpdateMC(MC); }
private void CreateVoting(CircleController controller) { EnterDataControl control = new EnterDataControl(); control.Status = new CreateDialogStatus(controller); control.Dock = DockStyle.Fill; control.ShowNextControl += new ShowNextControlHandler(Control_ShowNextControl); control.CloseCreateDialog += new CloseCreateDialogHandler(Control_CloseCreateDialog); control.Prepare(); Controls.Add(control); }
private void showCircle(Vector3 pos) { CircleController controller = circle.GetComponentInChildren <CircleController>(); controller.initCircle(); mColor32 = controller.getColor32(); moveCircle(pos); circle.SetActive(true); SoundManager.sInstance.playOneShot(AudioClipManager.sinstance.AC_GEM_GET); }
public void drawArrow(CircleController toCircle, bool direct) { Vector3 ArrowOrigin = circleController.transform.position; Vector3 ArrowTarget = toCircle.transform.position; GameObject myLine = Instantiate(arrowPrefab, transform, false); LineRenderer lr = myLine.GetComponent <LineRenderer>(); lr.material = direct ? directArrowMaterial : reverseArrowMaterial; lr.SetPosition(0, Vector3.Lerp(ArrowOrigin, ArrowTarget, 0.1f)); lr.SetPosition(1, Vector3.Lerp(ArrowOrigin, ArrowTarget, 0.9f)); }
// Use this for initialization void Start() { _myRb = GetComponent <Rigidbody2D>(); _myCol = GetComponent <CircleCollider2D>(); _mySprite = GetComponent <SpriteRenderer>(); _mySprite.color = RocketSystem.Instance.GetComponent <SpriteRenderer>().color; _myTr = transform; _circleControl = CircleController.Instance; _colorTableComponent = ColorTableComponent.Instance; SetStartPosition(); FlyUp(_flyUpPosition.y); RecycleCircles(); }
public static void ShowInfo(CircleController controller, Form parentForm) { if (instance == null) { instance = new InitScreen(); } instance = new InitScreen(); instance.controller = controller; instance.parentForm = parentForm; instance.parentForm.Enabled = false; instance.Show(); }
public static void TryFixVoterCertificate(CircleController controller, Certificate certificate) { CreateCertificateDialog dialog = new CreateCertificateDialog(); if (dialog.TryResumeCertificateCreation(controller, certificate)) { dialog.ShowDialog(); } else { dialog.CreateNewVoterCertificate(controller); dialog.ShowDialog(); } }
public static void ShowInfo(CircleController controller, Form parentForm) { if (instance == null) { instance = new TextStatusDialog(); } instance = new TextStatusDialog(); instance.Text = Resources.StatusDialogTitle; instance.controller = controller; instance.parentForm = parentForm; instance.parentForm.Enabled = false; instance.Show(); }
// Use this for initialization void Start() { score = 0; currentTime = 0; if (player == null) { player = GameObject.Find("Player"); } playerController = player.GetComponent<CircleController>(); lvlCompScreen.enabled = false; lvlEnd = false; UpdateKESlider(); UpdateScoreText(); }
public void InstantiateComboUI() { int c = CircleController.getComboCounter(); if (c == ScoreManager.TWO_TIMES_COMBO_LIMIT + 1) { twoTimesCombo.SetActive(true); StartCoroutine(deactivateObjectAfterAnAmountOfTime(twoTimesCombo, 1.5f)); } else if (c == ScoreManager.THREE_TIMES_COMBO_LIMIT + 1) { threeTimesCombo.SetActive(true); StartCoroutine(deactivateObjectAfterAnAmountOfTime(threeTimesCombo, 1.5f)); } }
/// <summary> /// Method called on application start /// </summary> private void Awake() { ARCanvas._actualARCanvas = this; this._placementController = PlacementControllerGO.GetComponent <PlacementController>(); this._dialogWindow = this.GetComponentInChildren <DialogWindow>(true); this._circleController = this.GetComponentInChildren <CircleController>(true); this._precisePoistioningComponent = this.GetComponentInChildren <PrecisePositioningComponent>(true); var waitingForSurfaceLabelGO = this.transform.Find("WaitingForSurfaceLabel").gameObject; var backButtonGO = this.transform.Find("BackButton").gameObject; var pickUpButtonGO = this.transform.Find("PickUpModelButton").gameObject; var showDoorsButtonGO = this.transform.Find("ShowDoorsButton").gameObject; var hideDoorButtonGO = this.transform.Find("HideDoorsButton").gameObject; var showCoversButtonGO = this.transform.Find("ShowCoversButton").gameObject; var hideCoversButtonGO = this.transform.Find("HideCoversButton").gameObject; var showPrecisePositioningButtonGO = this.transform.Find("ShowPreciseButton").gameObject; var hidePrecisePositioningButtonGO = this.transform.Find("HidePreciseButton").gameObject; var loadingPageGO = this.transform.Find("LoadingPage").gameObject; this._scaleLabelGO = this.transform.Find("ScaleLabel").gameObject; var scaleLabelTextGO = _scaleLabelGO.transform.Find("Label").gameObject; this._waitingForSurfaceLabel = waitingForSurfaceLabelGO.GetComponent <TextMeshProUGUI>(); this._goBackButton = backButtonGO.GetComponent <ClickableImage>(); this._pickUpModelButton = pickUpButtonGO.GetComponent <ClickableImage>(); this._showDoorsButton = showDoorsButtonGO.GetComponent <ClickableImage>(); this._hideDoorsButton = hideDoorButtonGO.GetComponent <ClickableImage>(); this._showCoversButton = showCoversButtonGO.GetComponent <ClickableImage>(); this._hideCoversButton = hideCoversButtonGO.GetComponent <ClickableImage>(); this._showPrecisePositioningButton = showPrecisePositioningButtonGO.GetComponent <ClickableImage>(); this._hidePrecisePositioningButton = hidePrecisePositioningButtonGO.GetComponent <ClickableImage>(); this._loadingPage = loadingPageGO.GetComponent <LoadingPage>(); this._waitingForSurfaceLabel.text = Translator.GetTranslation("WaitingForSurfaceLabel.ContentText"); this._scaleLabelText = scaleLabelTextGO.GetComponent <TextMeshProUGUI>(); this._scaleLabelText.text = _getScaleLabelTranslationText(); //Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; }
public bool lvlEnd; // Player completed level // Use this for initialization void Start() { score = 0; currentTime = 0; if (player == null) { player = GameObject.Find("Player"); } playerController = player.GetComponent <CircleController>(); lvlCompScreen.enabled = false; lvlEnd = false; UpdateKESlider(); UpdateScoreText(); }
void Awake() { if (instance == null) { instance = this; } circleControllerReference = GameObject.FindWithTag("circleController").GetComponent <CircleController> (); twoTimesCombo.SetActive(false); threeTimesCombo.SetActive(false); animht1 = heart1.GetComponent <Animator> (); animht2 = heart2.GetComponent <Animator> (); }
// Use this for initialization void Start() { _circleController = CircleController.Instance; _poolCircle = ObjectPoolSystem.Instance.GetQueuePool(0); for (int i = 0; i < _poolCircle.Count; i++) { var circle = _poolCircle.Dequeue(); _poolCircle.Enqueue(circle); var position = new Vector2(Random.Range(-1f, 1f), transform.position.y); circle.transform.position = position; circle.transform.localScale = Vector3.one * Random.RandomRange(0.2f, 0.8f); circle.SetActive(true); circle.GetComponent <Rigidbody2D>().gravityScale = 0; var circleInfo = new CircleInfo(circle.transform, Time.time, Random.Range(1, 3) * 2 - 3, circle.transform.localScale.x * 10f, 2f); circleInfo.Active = false; _circles.Add(circleInfo); } }
// Start is called before the first frame update void Start() { PlayerPrefs.DeleteKey("SCORE"); currentStageNum = PlayerPrefs.GetInt("ClearStage", 0); circleController = timingCircle.GetComponent <CircleController>(); sceneScript = sceneManager.GetComponent <SceneScript>(); audioSource = this.gameObject.GetComponent <AudioSource>(); noteNum = 0; timer = 60; canShot = true; playerLevel = 1; currentPlayerPosNum = 3; isPlaying = false; isZone = true; playerLevel = 1; animator = this.GetComponent <Animator>(); if (currentStageNum >= 5) { maxNoteNum = 1; if (currentStageNum >= 10) { maxNoteNum = 2; } } else { maxNoteNum = 0; } shotTimingValue_Low = shotTimingValues_Low[currentStageNum % 5]; shotTimingValue_High = shotTimingValues_High[currentStageNum % 5]; /*if(currentStageNum % 5 <= 2) * { * shotTimingValue_Low = 0.05f; * shotTimingValue_High = 0.85f; * } * else * { * shotTimingValue_Low = 0.075f; * shotTimingValue_High = 0.5f; * }*/ }
// Update is called once per frame void Update() { var horizontalAxis = Input.GetAxisRaw("Horizontal"); var verticalAxis = Input.GetAxisRaw("Vertical"); if (externalHorizontalAxis != 0f) { horizontalAxis = externalHorizontalAxis; } if (externalVerticalAxis != 0f) { verticalAxis = externalVerticalAxis; } Vector2 movement = Vector2.zero; movement.x += (Vector2.right).x * horizontalAxis; movement.y += (Vector2.up).y * verticalAxis; movement.Normalize(); // Rotate ship to match direction. if (movement != Vector2.zero) { if (!source.isPlaying) { source.Play(); } float angle = Mathf.Atan2(movement.y, movement.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); } else { source.Stop(); } GameObject circle = GameObject.Find("Circle"); CircleController circleController = circle.GetComponent <CircleController>(); movement = movement * circleController.moveSpeed; player.MovePosition((Vector2)(transform.position) + movement * Time.deltaTime); }
public bool OverlapCircle(CircleController tmp) { CircleCollider2D myCollider = this.GetComponent <CircleCollider2D>(); ContactFilter2D filter = new ContactFilter2D(); filter.layerMask = LayerMask.GetMask("Character"); Collider2D[] res = new Collider2D[5]; int count = myCollider.OverlapCollider(filter, res); for (int i = 0; i < count; i++) { if (res[i].gameObject == tmp.gameObject) { return(true); } } return(false); }
public CircleControllerTest() { var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>(); optionsBuilder.UseInMemoryDatabase(); var context = new ApplicationDbContext(optionsBuilder.Options); var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new AutoMapperProfiles()); }); var mapper = mockMapper.CreateMapper(); _repo = new CircleRepoFake(context); _photoRepo = new PhotoRepoFake(context); _appUserRepo = new AppUserRepoFake(context); _controller = new CircleController(_appUserRepo, mapper, _repo, _photoRepo, null, null); }
//TODO: Get scaleData from remote void Start() { goldController = GoldController.Instance; goldController.SetGoldView(goldView); goldgeneratorControllers = new List <GoldGeneratorController>(); circleControllers = new List <CircleController>(CircleViews.Length); for (int i = 0; i < CircleViews.Length; i++) { CircleController controller = new CircleController(CircleViews[i], scaleData, goldController.ChangeGoldValue); controller.OnPurchased += OnCirclePurchased; circleControllers.Add(controller); } goldgeneratorControllers.AddRange(circleControllers); tapController = new TapController(tapView, blockView, scaleData, goldController.ChangeGoldValue); goldgeneratorControllers.Add(tapController); }
public void AddCircle(int circleId, double circleX, double circleY, double circleRadius, bool belongsToCurrentPlayer) { CircleController newCircle = Instantiate(circlePrefab); newCircle.Id = circleId; newCircle.SetName(circleId.ToString(), true); newCircle.transform.position = new Vector2((float)circleX, (float)circleY); newCircle.transform.localScale = new Vector3((float)circleRadius, (float)circleRadius, (float)circleRadius); newCircle.isMoving = true; if (belongsToCurrentPlayer) { newCircle.transform.SetParent(currentPlayerContainer.transform); currentPlayerCircles.Add(newCircle); } else { newCircle.transform.SetParent(otherPlayersContainer.transform); otherPlayersCircles.Add(newCircle); } }
private void HitCircle(CircleController circle) { this.circle = circle; ArrowState = State.ON_CIRCLE; outOfBorder = false; timeSinceStart = 0; Vector2 touchPosition = transform.position; Vector2 circleCenter = circle.gameObject.transform.position; Vector2 touchToCenter = circleCenter - touchPosition; Vector2 prevRbVelocity = rb.velocity; rb.velocity = Vector2.zero; float angleBetVectors = Vector2.Angle(circleCenter - touchPosition, Vector2.right); startRotation = Mathf.PI + angleBetVectors * Mathf.Deg2Rad; currentRotationX = null; Vector2 circleTangent = new Vector2(touchToCenter.y, -touchToCenter.x) / touchToCenter.magnitude; float perpArrowAngle = Vector2.Angle(circleTangent, prevRbVelocity); if (perpArrowAngle >= 90) { movingClockwise = true; } else { movingClockwise = false; } // play circle fade out animation circle.FadeOut(); SoundManager.Instance.PlayHit(); ScoreManager.Instance.DisplayScore(Mathf.FloorToInt(transform.position.y + Camera.main.orthographicSize)); }
private void MySceneLoaderChecker(Scene scene, LoadSceneMode mode) { if (scene.name.Equals(playScene)) // if we load the play scene { if (gameStartedFromMenu) { //setting data for the start of the game score = 0; lifes = 3; timer = 120f; if (AdManager.instance.areAllAdsLoaded()) // continue ad logic only if all the ads are loaded { GamePreferences.IncrementAdsCounter(); // everytime we start a new game the ads counter it's incremented by one } //seding data to game controllers ScoreManager.instance.takeDataFromGameManager(score, lifes); CircleController.setTimer(timer); } else if (gameReplayed) { // making the view UIManager.instance.changeLifesUi(lifes); // sending data to game controllers CircleController.setTimer(timer); ScoreManager.instance.takeDataFromGameManager(score, lifes); } // we send all the data to other classes during the game so they will process the data and it will not be lost } else if (scene.name.Equals(menuScene)) { if (GamePreferences.ShouldShowAd()) // it verifies if we reached GamePreferences.ADD_NUMBER_SHOW to show ad { AdManager.instance.ShowUIAd(); } } AdManager.instance.RequestAllAds(); // request ads everytime we load a new scene }
// ------------------------------------------------------- // // Game Round Begin // 1. Spawn Random Enemies // ------------------------------------------------------- // void SpawnNewRound() { ClearOldRoundData(); _roundNumber++; _difficultyScale = DifficultyCurve.Evaluate(_roundNumber / MaxRound); Debug.Log(_difficultyScale); // Round Paramaters int numEnemies = 2 + (int)Mathf.Round((_difficultyScale) * 1); float minSize = 1; float maxSize = _randomRange - _difficultyScale * 1; float minAreaSize = (_randomRange + minSize) + _difficultyScale * 2; float roundTime = 5 * _difficultyScale; Vector2 center = GetLevelStartPos(); for (int i = 0; i < numEnemies; i++) { Vector2 randUnit = Random.insideUnitCircle; Vector2 offset = randUnit * (maxSize - minSize + 1) + randUnit * minSize; CircleController obj = SpawnCircle(offset + center); obj.color = Color.red; Enemies.Add(obj); } roundPlaying = true; // Start Area AreaController.StopScaleDown(); AreaController.SyncPosition(MC.transform.position); AreaController.BeginScaleDown(minAreaSize, roundTime, () => { roundPlaying = false; GameOver(); }); }
public void Display(CircleController controller, VoterCertificate voterCertificate, VotingDescriptor2 voting) { this.controller = controller; this.voterCertificate = voterCertificate; this.voting = voting; this.votingControl.Display(voting); if (this.voterCertificate == null) { this.voteButton.Text = Resources.VotingDialogConfirm; } else { this.voteButton.Text = Resources.VotingDialogVote; } this.cancelButton.Enabled = true; this.nextButton.Enabled = this.votingControl.CanNext; this.previousButton.Enabled = this.votingControl.CanPrevious; this.voteButton.Enabled = this.voterCertificate == null || this.votingControl.Valid; }
void Start() { gscs = FindObjectsOfType <GameStartController>(); level = 1; remainTime = 0f; remainTimeOfDress = 0f; theCircle = FindObjectOfType <CircleController>(); score = 0; reduceScore = 0; //读取最高分 if (PlayerPrefs.HasKey("HighestScore")) { highestScore = PlayerPrefs.GetInt("HighestScore"); textHighestScore.text = highestScore.ToString(); } BGM[BGMnum].Play(); //判断是否需要提示 if (!PlayerPrefs.HasKey("NeedHint")) { PlayerPrefs.SetInt("NeedHint", 0); } // StartGame(); }
// Use this for initialization void Start() { theCirController = FindObjectOfType <CircleController>(); }
public void ReplaceCircle(CircleController theCirCtrl) { theCirController = theCirCtrl; }
private void CreateNewAuthorityCertificate(CircleController controller) { SetControl( new EnterAuthorityCertificateDataControl(), new CreateDialogStatus(controller)); }
public CreateDialogStatus(CircleController controller) { Controller = controller; }
public static void ShowCreateNewVoterCertificate(CircleController controller) { CreateCertificateDialog dialog = new CreateCertificateDialog(); dialog.CreateNewVoterCertificate(controller); dialog.ShowDialog(); }
private bool TryResumeCertificateCreation(CircleController controller, Certificate certificate) { CreateDialogStatus status = new CreateDialogStatus(controller); status.Certificate = certificate; if (status.TryLoadSignatureRequest()) { SetControl( new PrintAndUploadCertificateControl(), status); return true; } else { return false; } }
public static DialogResult ShowVoting(CircleController controller, VoterCertificate voterCertificate, VotingDescriptor2 voting) { VotingDialog dialog = new VotingDialog(); dialog.Display(controller, voterCertificate, voting); return dialog.ShowDialog(); }
public static void ShowCreateVoting(CircleController controller) { CreateVotingDialog dialog = new CreateVotingDialog(); dialog.CreateVoting(controller); dialog.ShowDialog(); }
public static void ShowCertificates(CircleController controller) { CertificateManagerDialog dialog = new CertificateManagerDialog(); dialog.Set(controller); dialog.ShowDialog(); }
private void CreateNewCertificate(CircleController controller) { SetControl( new SelectCertificateTypeControl(), new CreateDialogStatus(controller)); }
public void Set(CircleController controller) { this.controller = controller; LoadCertificates(); }
public void OnCollison(CircleController opposite) { // 1.collect { float r = Radius + opposite.Radius; float vx = transform.position.x - opposite.transform.position.x; float vz = transform.position.z - opposite.transform.position.z; float len = Mathf.Sqrt(vx * vx + vz * vz); float distance = r - len; if(len > 0.0f) len = 1.0f / len; vx *= len; vz *= len; distance /= 2.0f; m_collect.x += vx * distance; m_collect.z += vz * distance; opposite.m_collect.x -= vx * distance; opposite.m_collect.z -= vz * distance; } // 2.Reflect. { Vector3 v = opposite.transform.position - transform.position; float t1 = -(v.x * Power.x + v.z * Power.z) / (v.x * v.x + v.z * v.z); float arx = Power.x + v.x * t1; float arz = Power.z + v.z * t1; float t2 = -(-v.z * Power.x + v.x * Power.z) / (v.z * v.z + v.x * v.x); float amx = Power.x - v.z * t2; float amz = Power.z + v.x * t2; float t3 = -(v.x * opposite.Power.x + v.z * opposite.Power.z) / (v.x * v.x + v.z * v.z); float brx = opposite.Power.x + v.x * t3; float brz = opposite.Power.z + v.z * t3; float t4 = -(-v.z * opposite.Power.x + v.x * opposite.Power.z) / (v.z * v.z + v.x * v.x); float bmx = opposite.Power.x - v.z * t4; float bmz = opposite.Power.z + v.x * t4; float e = 1.0f; float am = m_mass; float bm = opposite.m_mass; float adx = (am * amx + bm * bmx + bmx * e * bm - amx * e * bm) / (am + bm); float bdx = - e * (bmx - amx) + adx; float adz = (am * amz + bm * bmz + bmz * e * bm - amz * e * bm) / (am + bm); float bdz = - e * (bmz - amz) + adz; m_reflect.x += adx + arx; m_reflect.z += adz + arz; opposite.m_reflect.x += bdx + brx; opposite.m_reflect.z += bdz + brz; } }