Raccoon animation and scene changes #415
|
@ -7591,7 +7591,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 149697411
|
Mesh: 149697411
|
||||||
Material: 126974645
|
Material: 128805346
|
||||||
IsActive: true
|
IsActive: true
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
|
@ -7621,6 +7621,10 @@
|
||||||
Position Offset: {x: 0, y: 0.300000012, z: 0}
|
Position Offset: {x: 0, y: 0.300000012, z: 0}
|
||||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
Animator Component:
|
||||||
|
Rig: 77816045
|
||||||
|
AnimationController: 0
|
||||||
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: PlayerController
|
- Type: PlayerController
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -7639,6 +7643,10 @@
|
||||||
heavyMultiper: 0.5
|
heavyMultiper: 0.5
|
||||||
silhouettePlayer: 462
|
silhouettePlayer: 462
|
||||||
silhouetteBag: 465
|
silhouetteBag: 465
|
||||||
|
idleClip: 227450439
|
||||||
|
walkClip: 229125027
|
||||||
|
runClip: 228149757
|
||||||
|
pickUpClip: 0
|
||||||
- Type: PickAndThrow
|
- Type: PickAndThrow
|
||||||
Enabled: true
|
Enabled: true
|
||||||
throwForce: [8, 10, 8]
|
throwForce: [8, 10, 8]
|
||||||
|
|
|
@ -3,13 +3,18 @@ using System;
|
||||||
|
|
||||||
public class PlayerIdleState : BaseState
|
public class PlayerIdleState : BaseState
|
||||||
{
|
{
|
||||||
public PlayerIdleState(StateMachine stateMachine) : base(stateMachine)
|
private AnimationClipAsset idleClip;
|
||||||
|
private Animator animator;
|
||||||
|
public PlayerIdleState(StateMachine stateMachine, Animator ani , AnimationClipAsset clip) : base(stateMachine)
|
||||||
{
|
{
|
||||||
stateName = "Idle State";
|
stateName = "Idle State";
|
||||||
|
idleClip = clip;
|
||||||
|
animator = ani;
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
|
animator.Play(idleClip);
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,13 +6,19 @@ public class PlayerRunState : BaseState
|
||||||
private float timer;
|
private float timer;
|
||||||
private float delay = 0.25f;
|
private float delay = 0.25f;
|
||||||
|
|
||||||
public PlayerRunState(StateMachine stateMachine) : base(stateMachine)
|
private AnimationClipAsset runClip;
|
||||||
|
private Animator animator;
|
||||||
|
|
||||||
|
public PlayerRunState(StateMachine stateMachine, Animator ani, AnimationClipAsset clip) : base(stateMachine)
|
||||||
{
|
{
|
||||||
stateName = "Run State";
|
stateName = "Run State";
|
||||||
|
animator = ani;
|
||||||
|
runClip = clip;
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
|
animator.Play(runClip);
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,14 +5,20 @@ public class PlayerWalkState : BaseState
|
||||||
{
|
{
|
||||||
private float timer;
|
private float timer;
|
||||||
private float delay = 0.5f;
|
private float delay = 0.5f;
|
||||||
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine)
|
|
||||||
|
private AnimationClipAsset walkClip;
|
||||||
|
private Animator animator;
|
||||||
|
public PlayerWalkState(StateMachine stateMachine, Animator ani, AnimationClipAsset clip) : base(stateMachine)
|
||||||
{
|
{
|
||||||
stateName = "Walk State";
|
stateName = "Walk State";
|
||||||
|
animator = ani;
|
||||||
|
walkClip = clip;
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
timer = delay;
|
timer = delay;
|
||||||
|
animator.Play(walkClip);
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,6 +82,21 @@ public class PlayerController : Script
|
||||||
public GameObject silhouetteBag;
|
public GameObject silhouetteBag;
|
||||||
private Renderable silhouetteBagRend;
|
private Renderable silhouetteBagRend;
|
||||||
|
|
||||||
|
#region Serialized Fields
|
||||||
|
[SerializeField]
|
||||||
|
private AnimationClipAsset idleClip;
|
||||||
|
[SerializeField]
|
||||||
|
private AnimationClipAsset walkClip;
|
||||||
|
[SerializeField]
|
||||||
|
private AnimationClipAsset runClip;
|
||||||
|
[SerializeField]
|
||||||
|
private AnimationClipAsset pickUpClip;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Components
|
||||||
|
public Animator animator { get; private set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
//default setup
|
//default setup
|
||||||
|
@ -98,18 +113,22 @@ public class PlayerController : Script
|
||||||
//rigidbody check
|
//rigidbody check
|
||||||
rb = GetComponent<RigidBody>();
|
rb = GetComponent<RigidBody>();
|
||||||
if (!rb)
|
if (!rb)
|
||||||
Debug.LogError("RigidBody is NULL!");
|
Debug.LogError("RigidBody is MISSING!");
|
||||||
|
|
||||||
//Transform check
|
//Transform check
|
||||||
tranform = GetComponent<Transform>();
|
tranform = GetComponent<Transform>();
|
||||||
if(!tranform)
|
if(!tranform)
|
||||||
Debug.LogError("tranform is NULL!");
|
Debug.LogError("tranform is MISSING!");
|
||||||
|
|
||||||
|
animator = GetComponent<Animator>();
|
||||||
|
if (!animator)
|
||||||
|
Debug.LogError("Animator is MISSING!");
|
||||||
|
|
||||||
stateMachine = AddScript<StateMachine>();
|
stateMachine = AddScript<StateMachine>();
|
||||||
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
||||||
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
|
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine, animator , idleClip));
|
||||||
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine));
|
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine, animator , walkClip));
|
||||||
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
|
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine, animator, runClip));
|
||||||
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
|
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
|
||||||
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
|
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
|
||||||
dictionary.Add(typeof(PlayerLandState), new PlayerLandState(stateMachine));
|
dictionary.Add(typeof(PlayerLandState), new PlayerLandState(stateMachine));
|
||||||
|
|
Loading…
Reference in New Issue