-2
Mine’s making that mistake twice. here is my command:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Porta : MonoBehaviour {
private Animator porta;
private bool colidindo;
// Start is called before the first frame update
void Start() {
porta = GetComponent<Animator> ();
porta.SetInteger ("abreFecha", 0);
colidindo = false;
}
// Update is called once per frame
void Update() {
if ((Input.GetKeyDown (KeyCode.E)) && (colidindo = true)){
if ((porta.GetCurrentAnimatorStateInfo (0).IsName ("portaParada")) (porta.GetCurrentAnimatorStateInfo (0).IsName ("fechaPorta"))){
porta.SetInteger ("abreFecha", 1);
} else {
porta.SetInteger ("abreFecha", 2);
}
}
}
}
void OnTriggerEnter (Collider other)
{
if (other.gameobject.CompareTag("Player")){
colidindo = true;
}
}
void OnTriggerExit (Collider other){
if (other.gameobject.CompareTag("Player")){
colidindo = false;
}
}