private void DieCheckFunction() { if (!IsDead()) { _Player_State = EnumHolder.States.IDLE; } }
private void MovingCheckFunction() { //if (!(Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D))) if (InputManager.LS_Joystick() == Vector3.zero) { _Player_State = EnumHolder.States.IDLE; return; } float ForwardAngle = Vector3.Angle(gameObject.transform.forward.normalized, (_PrevPosition - gameObject.transform.position).normalized); float RightAngle = Vector3.Angle(gameObject.transform.right.normalized, (_PrevPosition - gameObject.transform.position).normalized); if (ForwardAngle < 30) { _Player_Dir = DIRECTION.BACK; } else if (ForwardAngle > 150) { _Player_Dir = DIRECTION.FRONT; } else if (ForwardAngle >= 30 && ForwardAngle <= 150) { if (RightAngle < 90) { _Player_Dir = DIRECTION.RIGHT; } else { _Player_Dir = DIRECTION.LEFT; } } _PrevPosition = gameObject.transform.position; }
private void IdleCheckFunction() { _PrevPosition = gameObject.transform.position; //if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)) if (InputManager.LS_Joystick() != Vector3.zero) { _Player_Dir = DIRECTION.FRONT; _Player_State = EnumHolder.States.MOVING; return; } }
private void Awake() { _CurrentSkillOutcome = null; _CurrentSelection = 0; _Cast_Trigger = false; _Is_Casting = false; _Is_VacuumSFXPlayed = false; _Player_Stats = EnumHolder.Instance.GetStats(gameObject.name); _Player_Stats.DamageMultiplyerProperties = _Player_Stats.HealthMultiplyerProperties = _Player_Stats.SpeedMultiplyerProperties = _Player_Stats.SuckingPowerMultiplyerProperties = 1; _Player_Stats.HealthProperties = MaxHitPoint; _Player_Stats.SkillPowerMultiplyerProperties = 1.0f; _Money = 0; _Player_State = EnumHolder.States.IDLE; _Player_Dir = DIRECTION.FRONT; _Animator = gameObject.GetComponentInChildren <Animator>(); _Status = gameObject.GetComponent <Status>(); _Status.Init(); _CheckFuntions.Add(EnumHolder.States.IDLE, IdleCheckFunction); _CheckFuntions.Add(EnumHolder.States.MOVING, MovingCheckFunction); _CheckFuntions.Add(EnumHolder.States.KICKING, KickingCheckFunction); _CheckFuntions.Add(EnumHolder.States.DIE, DieCheckFunction); _SuckingParticle.SetActive(false); _SuckingRadius.SetActive(false); _Animator.SetBool("IsSucking", false); _Skills.Capacity = (int)_Skill_Slots; for (int i = 0; i < _Skill_Slots; i++) { _Skills.Add(null); } }
// Update is called once per frame private void Update() { _Status.UpdateStatMultiplyer(ref _Player_Stats); TakeDamage(_Status.GetValue(EnumHolder.EffectType.TAKEDAMAGE)); _CheckFuntions[_Player_State].Invoke(); _Animator.SetInteger("State", (int)_Player_State); _Animator.SetInteger("Direction", (int)_Player_Dir); if (!_Is_Casting && _Player_State != EnumHolder.States.KICKING && _Player_State != EnumHolder.States.DIE && Speed > 0) { if (InputManager.Suck_Input()) { StartSuck(); _Animator.SetBool("IsSucking", true); if (!_Is_VacuumSFXPlayed) { _Is_VacuumSFXPlayed = true; AudioManager.Instance.PlaySEWithFadeIn(_VacuumSFX.name, 0.5f, true); } } else { if (_Is_VacuumSFXPlayed) { _Is_VacuumSFXPlayed = false; AudioManager.Instance.StopSE(_VacuumSFX.name); } if (_SuckingParticle.activeSelf) { _SuckingParticle.SetActive(false); } if (_SuckingRadius.activeSelf) { _SuckingRadius.SetActive(false); } if (_Animator.GetBool("IsSucking")) { _Animator.SetBool("IsSucking", false); } } //Reset if (Input.GetKeyDown(KeyCode.LeftControl)) { ResetOrbSlots(); _tmpStock.Clear(); } //Storing of skill if (InputManager.CombineOrbs_Input()) { StoreSkills(); _preMan.SwitchMode(_Skills[_CurrentSelection]); // スライムストックから使ったスライムを抜く foreach (var type in _tmpStock) { _SlimeStock[type]--; } _tmpStock.Clear(); } if (_Skills.Count > 0) { if (_Skills.Count > 1) { float position = InputManager.SkillScroll_Input(); if (position > 0f) { AudioManager.Instance.PlaySE(_SkillSwapSFX.name); --_CurrentSelection; } else if (position < 0f) { AudioManager.Instance.PlaySE(_SkillSwapSFX.name); ++_CurrentSelection; } } else { _CurrentSelection = 0; } if (InputManager.UseSkills_Input()) { if (!_Cast_Trigger) { UseSkill(); _Cast_Trigger = true; if (_Skills.Count > 0) { _preMan.SwitchMode(_Skills[_CurrentSelection]); } } } else { _Cast_Trigger = false; } } } if (_Is_Casting) { CastingCheckFunction(); } if (IsDead() && _Player_State != EnumHolder.States.DIE) { if (_Is_Casting) { ResetCurrentUsedSkill(); } _Player_State = EnumHolder.States.DIE; GameStateManager.Instance.PlayerDead(); } if (_CurrentSelection < 0) { _CurrentSelection = _Skills.Count - 1; } else if (_CurrentSelection > _Skills.Count - 1) { _CurrentSelection = 0; } // change prediction line by current skill if (_Skills.Count > 0) { if (_CurrentSelection != _OldSelection) { _preMan.SwitchMode(_Skills[_CurrentSelection]); } if (_Skills[_CurrentSelection] != null) { _Skills[_CurrentSelection].GetSkillTier(); } } else { _preMan.SwitchMode(null); } //// テキストコンポーネントを取得し、スライムの数を入れる //foreach (var slime in _SlimeStock) { // var panel = _slimeStockCanvas.gameObject.transform.Find("Panel"); // var image = panel.Find(slime.Key.name.ToString()); // var text = image.Find("Num").GetComponent<Text>(); // text.text = "× " + slime.Value.ToString(); //} // スライムの選択を行う SelectSlime(); _OldSelection = _CurrentSelection; }