void Update() { if (TimeScaler.Paused) { return; } for (int i = 0; i < SkillCooldowns.Length; i++) { if (SkillCooldowns[i] > 0) { SkillCooldowns[i] -= Time.deltaTime; } } //input move = Vector2.zero; allowMove = true; inputFrame.Clear(); inputFrame.WantDirection = LookDirection; OnInputRequest?.Invoke(ref inputFrame); //swap weapon if (inputFrame.SwapWeapon >= 0) { SwapWeapon(inputFrame.SwapWeapon); } //movement control if (OnAllowMove != null) { allowMove = OnAllowMove(); } if (allowMove) { Vector2 up; Vector2 right; if (inputFrame.LocalTransform) { up = LookDirection * (Vector3.right * inputFrame.up); right = transform.forward * inputFrame.right; } else { up = Vector2.up * inputFrame.up; right = Vector2.right * inputFrame.right; } if (inputFrame.up != 0f || inputFrame.right != 0f) { move = (up + right).normalized; } } WantDirection = inputFrame.WantDirection; //look direction if (OnLookDirection != null) { LookDirection = OnLookDirection(); } //combine OnCombineMove?.Invoke(ref move); //weapons if (CurrentWeapon != null && nextWeapon < 0) { if (inputFrame.PrimaryAttackTrigger) { CurrentWeapon.FireTrigger(); } if (inputFrame.PrimaryAttackContinuous) { CurrentWeapon.FireContinuous(); } if (inputFrame.SecondaryAttackTrigger) { CurrentWeapon.AltFireTrigger(); } if (inputFrame.SecondaryAttackContinuous) { CurrentWeapon.AltFireContinuous(); } } if (CurrentOffhand != null && nextOffhand < 0) { if (inputFrame.SecondaryAttackTrigger) { CurrentOffhand.FireTrigger(); } if (inputFrame.SecondaryAttackContinuous) { CurrentOffhand.FireContinuous(); } } if (nextWeapon >= 0) { if (CurrentWeapon == null) { ChangeWeapon(); } else if (CurrentWeapon.HolsterTimer <= 0f) { ChangeWeapon(); } } if (nextOffhand >= 0) { if (CurrentOffhand == null) { ChangeWeapon(true); } else if (CurrentOffhand.HolsterTimer <= 0f) { ChangeWeapon(true); } } if (inputFrame.UseObject) { UseObject(); } }