Skip to content
Snippets Groups Projects
PlayerController.cs 2.18 KiB
Newer Older
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : Controller
{
    // Use this for initialization
    void Start ()
    {
        inputs = new Inputs();
        //fazer dinamico
        canMove = true;
        canSkill = true;
        myTurn = true;
        currentHand = 1;
    private void setup()
        controlType = new KeyBoardControl();
        animatorController = GetComponent<Animator>();
        OpponentController.handChange += updateOpponentHand;
    private void Update()
        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());
        inputs.block = Input.GetAxisRaw(controlType.getBlockInput());
    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;
    }