public override void HitSide(Line line, ColType c) { base.HitSide(line, c); WorldConstants.PlayPhysNoises.PlayNoise(PlayerPhysicsNoises.Events.SoftLand); if (Mathf.Abs(Owner.Velocity.x) > Owner.PlayerProps.MinimumFallSpeed) { Owner.HardLanding.Position = new Vector3(line.ConstValue, Owner.ActorBounds.center.y, Owner.HardLanding.Position.z); Owner.HardLanding.Emit(); WorldConstants.PlayPhysNoises.PlayNoise(PlayerPhysicsNoises.Events.HeavyLand); } else { Owner.SoftLanding.Position = new Vector3(line.ConstValue, Owner.ActorBounds.center.y, Owner.SoftLanding.Position.z); Owner.SoftLanding.Emit(); WorldConstants.PlayPhysNoises.PlayNoise(PlayerPhysicsNoises.Events.SoftLand); } WallSlideState ws = ScriptableObject.CreateInstance <WallSlideState>(); ws.JumpDir = c == ColType.Left ? (sbyte)-1 : (sbyte)1; Owner.ChangeState(ws, false); }
private void OnDisable() { IdleState.Dispose(); MoveState.Dispose(); JumpState.Dispose(); InAirState.Dispose(); LandState.Dispose(); WallSlideState.Dispose(); LedgeClimbState.Dispose(); CrouchIdleState.Dispose(); CrouchMoveState.Dispose(); SwordAttackState.Dispose(); HandAttackState.Dispose(); AirAttackState.Dispose(); SlideState.Dispose(); }
private void Start() { playtime = 0; pData = GetComponent <PlayerData>(); if (File.Exists(selectedProfilePath)) { selectedProfile = File.ReadAllText(selectedProfilePath); saveDataPath += selectedProfile + ".json"; if (File.Exists(saveDataPath)) { string json = File.ReadAllText(saveDataPath); var dto = JsonConvert.DeserializeObject <PlayerDTO>(json); pData.serializeData = dto.playerSerializeData; playtime = dto.Playtime; if (pData.HasCheckPoint) { transform.position = new Vector2(pData.PosX, pData.PosY); } } } pInput = new PlayerInput(pData); spriteRenderer = GetComponent <SpriteRenderer>(); audioSource = GetComponent <AudioSource>(); #region Initialize States IdleState = new IdleState(this, pInput, pData, "Idle_Animation"); RunningState = new RunningState(this, pInput, pData, "Running_Animation"); FallingState = new FallingState(this, pInput, pData, "Falling_Animation"); JumpState = new JumpState(this, pInput, pData, "Jump_Animation"); StartFallingState = new StartFallingState(this, pInput, pData, "Start_Falling_Animation"); WallSlideState = new WallSlideState(this, pInput, pData, "Wall_slide"); DashingState = new DashingState(this, pInput, pData, "Dash_Animation"); PrimaryAttackState = new PrimaryAttackState(this, pInput, pData, "Left_swing_attack"); GroundedSecondaryAttackState = new GroundedSecondaryAttackState(this, pInput, pData, "Right_swing_attack"); GroundedDownwardAttackState = new GroundedDownwardAttackState(this, pInput, pData, "Downward");; DeathState = new DeathState(this, pInput, pData, "Death_Animation"); CheckPointState = new CheckPointState(this, pInput, pData, "CheckPoint_Animation"); WallJumpState = new WallJumpState(this, pInput, pData, "Jump_Animation"); currentState = IdleState; #endregion Initialize States }
// Use this for initialization void Start() { m_player = GetComponent<Player>(); //m_wallRun = new WallRunState(); m_wallSlide = new WallSlideState(); }