ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Codigo SCRIP C# movimiento y animacion de personaje


Enviado por   •  8 de Mayo de 2019  •  Tareas  •  1.064 Palabras (5 Páginas)  •  172 Visitas

Página 1 de 5

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class MovimientoPC : MonoBehaviour

{

public Rigidbody rb;

public bool jump;

public float moveSpeed;

public float moveSpeed2;

public float moveSpeedBack;//movimiento del objeto

Animator anim;

CapsuleCollider col;

STATES currentState;

public bool vivo = true;

enum STATES//animaciones

{

IDLE,

WALKING,

WALKINGBack,

RUN,

JUMP,

}

void Start()

{

rb = GetComponent<Rigidbody>();

anim = GetComponent<Animator>();

currentState = STATES.IDLE;

col = GetComponent<CapsuleCollider>();

jump = false;

}

void Update()

{

CheckConditions();

MakeBehaviour();

}

void CheckConditions()

{

if (vivo)

{

if (Input.GetKey(KeyCode.LeftShift))

{

currentState = STATES.RUN;

}

else if (Input.GetKey(KeyCode.W))

{

currentState = STATES.WALKING;

}

else if (Input.GetKey(KeyCode.S))

{

currentState = STATES.WALKINGBack;

}

else currentState = STATES.IDLE;

}

else

{

currentState = STATES.IDLE;

}

if (Input.GetKeyDown(KeyCode.Space))

...

Descargar como (para miembros actualizados)  txt (2.8 Kb)   pdf (32 Kb)   docx (8.7 Kb)  
Leer 4 páginas más »
Disponible sólo en Clubensayos.com