using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public CharacterController CharCont;
public CharacterMotor CharMotor;
//Holder for Weapon
public Transform WalkAnimationHolder;
public Transform JumpAnimationHolder;
public Transform SwayHolder;
public Transform RecoilHolder;
public WalkingState walkingstate = WalkingState.Idle;
public float velocityMagnitude;
public void FixedUpdate()
{
SwayController();
AnimationController();
SpeedController();
velocityMagnitude = CharCont.velocity.magnitude;
}
public void SpeedController()
{
if(Input.getAxis("Horizontail") != 0 && Input.getAxis("Vertical") != 0 && velocityMagnitude > 0)
{
if(Input.GetButton("Run"))
{
walkingstate = WalkingState.Running;
}
else
{
walkingstate = WalkingState.Walking;
}
}
else
{
walkingstate = WalkingState.Idle;
}
}
public void AnimationController()
{
if (walkingstate == WalkingState.Running)
{
WalkAnimationHolder.animation.CrossFade("WeaponRun1");
}
else if (walkingstate == WalkingState.Walking)
{
WalkAnimationHolder.animation.play("WeaponWalk1");
}
else
{
WalkAnimationHolder.animation.CrossFade("WeaponIdle1");
}
{
}
public void SwayController()
{
}
}
public enum WalkingState
{
Idle,
Walking,
Running,
}
I Can´t sole it plzz help it would be help full