void OnTriggerExit2D(Collider2D other) { if (gameControl.phase == TurnBasedBattle.battlePhase.Action) { if (other.tag == "PlayerDodgeBox") { PlayerMomentum playerMomentum = other.GetComponent <PlayerMomentum> (); playerMomentum.AddMomentum(momentumAdd); } } }
//Manages Heat Numbers and Calculations public void MatchLogic() { //heat if (_MatchHeat < 0) { _MatchHeat = 0; } else if (_MatchHeat > 100) { _MatchHeat = 100; } matchHeatMeter.fillAmount = _MatchHeat / 100f; //player momentum if (_PlayerMomentum < 0) { _PlayerMomentum = 0; } else if (_PlayerMomentum <= 20) { currentPlayerMomentum = PlayerMomentum.Cold; } else if (_PlayerMomentum <= 60) { currentPlayerMomentum = PlayerMomentum.Warm; } else if (_PlayerMomentum <= 85) { currentPlayerMomentum = PlayerMomentum.Hot; } else if (_PlayerMomentum <= 100) { currentPlayerMomentum = PlayerMomentum.Critical; } else if (_PlayerMomentum > 100) { _PlayerMomentum = 100; } matchPlayerMomMeter.fillAmount = _PlayerMomentum / 100f; //CPU momentum if (_OpponentMomentum < 0) { _OpponentMomentum = 0; } else if (_OpponentMomentum > 100) { _OpponentMomentum = 100; } matchOppMomMeter.fillAmount = _OpponentMomentum / 100f; }
/*--- Setup Methods ---*/ protected virtual void getComponents() { characterController = GetComponent <CharacterController>(); cameraController = GetComponentInChildren <CameraController>(); transformCameraHolder = cameraController.transform; transformCamera = GetComponentInChildren <Camera>().transform; headBobManager = new HeadBobManager( firstPersonViewConfig, firstPersonMovementConfig.moveBackwardsSpeedPercent, firstPersonMovementConfig.moveSideSpeedPercent ); playerMomentum = new PlayerMomentum(); }
void OnTriggerEnter2D(Collider2D other) { if (gameControl.phase == TurnBasedBattle.battlePhase.Action) { if (other.tag == "Enemy") { Enemy enemy = other.GetComponent <Enemy> (); if (enemy.isAlive) { PlayerMomentum playerMomentum = GameObject.Find("PlayerMomentum").GetComponent <PlayerMomentum> (); playerMomentum.momentum += momentumAdd; //print ("Enemy hit!"); other.gameObject.SendMessage("ApplyDamage", damage); //The last thing the bullet does... Destroy(gameObject); } } } }