Newer
Older
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : Controller
{
// Use this for initialization
void Start ()
{
canMove = true;
canSkill = true;
myTurn = true;
currentHand = 1;
controlType = new KeyBoardControl();
animatorController = GetComponent<Animator>();
OpponentController.handChange += updateOpponentHand;
inputs.behindBack = Input.GetAxisRaw(controlType.getBehindBackInput());
inputs.crossOver = Input.GetAxisRaw(controlType.getCrossOverInput());
inputs.stepBack = Input.GetAxisRaw(controlType.getStepBackInput());
inputs.horizontalMovement = Input.GetAxisRaw(controlType.getHorizontalInput());
inputs.verticalMovement = Input.GetAxisRaw(controlType.getVerticalInput());
inputs.steal = Input.GetAxisRaw(controlType.getStealInput());
public override void changeTurn()
{
GetComponentInParent<StepBackScript>().enabled = GetComponentInParent<StepBackScript>().enabled == true? false : true;
GetComponentInParent<CrossOverScript>().enabled = GetComponentInParent<CrossOverScript>().enabled == true? false : true;
GetComponentInParent<BehindBackScript>().enabled = GetComponentInParent<BehindBackScript>().enabled == true? false : true;
GetComponentInParent<RoubarBolaScript>().enabled = GetComponentInParent<RoubarBolaScript>().enabled == true? false : true;
FindObjectOfType<ForceBarController>().enabled = FindObjectOfType<ForceBarController>().enabled == true? false : true;
if (myTurn)
{
animatorController.SetTrigger("AtkTurn");
myTurn = false;
}
else
{
animatorController.SetTrigger("DefTurn");
myTurn = true;
}
//do something
}
private void updateOpponentHand(int currentHand)
{
opponentHand = currentHand;
}