// Update is called once per frame void Update() { if (Player != null) { if (Input.GetKeyDown(KeyCode.W)) { Player.Jump(); } else if (Input.GetKey(KeyCode.A)) { Player.MoveLeft(); } else if (Input.GetKey(KeyCode.D)) { Player.MoveRight(); } else if (Input.GetKey(KeyCode.LeftShift)) { Player.Sprint(); } else if (Input.GetKey(KeyCode.Mouse0)) { _combatsystem.Attack(); } } }
private IEnumerator Retaliate(LifeSystem targetLifeSystem, CombatSystem targetCombatSystem) { yield return(new WaitForSeconds(2)); if (!lifeSystem.IsDead) { transform.LookAt(targetLifeSystem.transform, Vector3.up); characterMotor.OnAttack(); combatSystem.Attack(targetLifeSystem); targetLifeSystem.GetComponent <CharacterMotor>().OnHit(); yield return(new WaitForSeconds(2)); } if (!targetLifeSystem.IsDead) { var targetDestination = GridHelper.GetNearestTile(transform.position + (targetLifeSystem.transform.position - transform.position).normalized * 5); targetLifeSystem.GetComponent <CharacterMotor>().setDestination(targetDestination); } targetCombatSystem.OnConbatFinished(); }
private void Update() { if (!character.IsOnGround) { character.SetState <FallingState>(); return; } ProcessMovement(Input.GetAxis(ControllerInput.MOVE_Y_AXIS), Input.GetAxis(ControllerInput.MOVE_X_AXIS)); ProcessCameraMovement(Input.GetAxis(ControllerInput.CAMERA_X_AXIS), Input.GetAxis(ControllerInput.CAMERA_Y_AXIS)); if (Input.GetButtonDown(ControllerInput.FOCUS_BUTTON)) { StartCoroutine(Focus()); } if (Input.GetButtonDown(ControllerInput.ATTACK_BUTTON)) { AlignSpawnPoint(projectileSpawn); combat.Attack(); } if (Input.GetButtonDown(ControllerInput.ABILITY_BUTTON)) { AlignSpawnPoint(abilitySpawn); abilities.Use(); } if (Input.GetButtonDown(ControllerInput.ROLL_BUTTON)) { StartCoroutine(Roll()); } if (Input.GetButtonDown(ControllerInput.SHOW_UI_BUTTON)) { FindObjectOfType <HUD>().ShowAllUI(); } ProcessWeaponToggle(); }