Assets/sskripte/PlayerController.cs(14,9): error CS0118: PlayerController.spriteController' is a
field’ but a `type’ was expected
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float gravity = 6;
public float speed = 10;
public float jumpPower = 10;
bool inputJump = false;
float velocity = 0;
Vector3 moveDirection = Vector3.zero;
CharacterController characterController;
spriteController spriteController;
bool lookRight = true;
// Use this for initialization
void Start () {
characterController = GetComponent<CharacterController>();
spriteController = GetComponent<spriteController>();
}
// Update is called once per frame
void Update () {
InputCheck();
Move ();
SetAnimation();
}
void InputCheck()
{
velocity = Input.GetAxis ("Horizontal") * speed;
if (velocity > 0)
lookRight = true;
if (velocity < 0)
lookRight = false;
if (Input.GetKeyDown (KeyCode.Space))
{
inputJump = true;
}
else
{
inputJump = false;
}
}
void Move()
{
if(characterController.isGrounded)
{
if (inputJump)
moveDirection.y = jumpPower;
}
moveDirection.x = velocity;
moveDirection.y -= gravity;
characterController.Move(moveDirection * Time.deltaTime);
}
void SetAnimation()
{
if(velocity > 0)
{
spriteController.SetAnimation(spriteController.AnimationType.goRight);
}
if (velocity < 0)
{
spriteController.SetAnimation(spriteController.AnimationType.goLeft);
}
if (velocity == 0)
{
if (lookRight)
{
spriteController.SetAnimation(spriteController.AnimationType.stayRight);
}
else
{
spriteController.SetAnimation(spriteController.AnimationType.stayLeft);
}
}
}
}