// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // controlArma =GameObject.Find ("Animacionwinchester_94_30-30").GetComponent<controlDeArmasJugador> (); cartuchos = animator.GetInteger("cartuchos")+1; animator.SetInteger ("cartuchos", cartuchos); //controlArma.muestraMunicion (); controlArma.municionActual++; controlArma.dismiNuirParque (); //controlArma.muestraMunicion (); //controlArma.muestraMunicion (); }
void selecionArma(int indice){ armaActiva.GetComponent<Animator> ().SetBool ("salir", true); armaActiva.equipado = false; foreach (GameObject go in listaDeArmas) { go.SetActive (false); } listaDeArmas [indice].SetActive (true); armaActiva = listaDeArmas [indice].GetComponent<controlDeArmasJugador> (); armaActiva.GetComponent<Animator> ().SetInteger ("cartuchos", armaActiva.GetComponent<controlDeArmasJugador> ().municionActual); armaActiva.GetComponent<Animator> ().SetInteger ("reservas", armaActiva.GetComponent<controlDeArmasJugador> ().municionReservas); //weaponType = armaActiva.wepoType; armaActiva.equipado = true; armaActiva.muestraMunicion (); weaponTypes = armaActiva.wepoType; }
//private GameObject cartucho1; // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { //cartuchos = animator.GetInteger("cartuchos")+1; controlArma =GameObject.Find ("/JugadorFps/FirstPersonCharacter/armas/animacionColt44-40").GetComponent<controlDeArmasJugador> (); cartucho = GameObject.Find ("/JugadorFps/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006"); m =cartucho.GetComponent<SkinnedMeshRenderer>(); cartucho0 = GameObject.Find ("/JugadorFps/FirstPersonCharacter/armas/animacionColt44-40/cartucho_000"); m0 =cartucho0.GetComponent<SkinnedMeshRenderer>(); controlArma.municionActual++; controlArma.dismiNuirParque (); m0.enabled = false; m.enabled = true; //cartucho.SetActive(false); }
// Use this for initialization void Start () { //balas.text="HOLAS"; foreach (GameObject go in listaDeArmas) { go.GetComponent<controlDeArmasJugador> ().tineDuenio= true; //Debug.Log ("ARMA" + go.GetComponent<controlDeArmasJugador> ().wepoType); if(go.activeSelf){ armaActiva = go.GetComponent<controlDeArmasJugador> (); } } //armaActiva = listaDeArmas [1].GetComponent<controlDeArmasJugador> (); weaponTypes = armaActiva.wepoType; // weaponType = armaActiva.wepoType; }
// private AnotherScript anotherScript; //private GameObject otherScript; //OtherScript = GetComponent(OtherScript); //public GameObject objectToAccess; // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { //Instantiate(flash,); // casquillos = animator.GetInteger ("casquillos"); anim = GameObject.Find ("Animacionwinchester_94_30-30").GetComponent<Animator> (); controlArma=GameObject.Find ("Animacionwinchester_94_30-30").GetComponent<controlDeArmasJugador> (); disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> (); //GameObject Object1 = GameObject.Find ("armas"); //Component anotherScript = Object1.GetComponent<disparosDelJugador> (); disparo.disparo(controlArma.danio); controlArma.disparar (); objetin = GameObject.FindGameObjectsWithTag ("canionWinchester"); posicionHueso = objetin [0].transform; Instantiate (esfera, posicionHueso.position,posicionHueso.rotation); // Script1.disparo (); }
// private camaraMira funcionesDeCamara; // private AnotherScript anotherScript; //private GameObject otherScript; //OtherScript = GetComponent(OtherScript); //public GameObject objectToAccess; // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { //funcionesDeCamara = Camera.main.transform.root.GetComponent<camaraMira>(); controlArma=GameObject.Find ("/JugadorFps/FirstPersonCharacter/armas/animacionColt44-40").GetComponent<controlDeArmasJugador> (); cartucho = GameObject.Find ("/JugadorFps/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006"); disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> (); anim = GameObject.Find ("animacionColt44-40").GetComponent<Animator> (); m =cartucho.GetComponent<SkinnedMeshRenderer>(); objetin = GameObject.FindGameObjectsWithTag ("canionColt"); m.enabled = false; posicionHueso = objetin [0].transform; //Instantiate(flash,); casquillos = animator.GetInteger ("casquillos"); //GameObject Object1 = GameObject.Find ("armas"); //Component anotherScript = Object1.GetComponent<disparosDelJugador> (); disparo.disparo (3); controlArma.disparar (); //Transform bone = GetComponent<Animator>().avatar.GetBone(BoneType.LeftShoulder); // Debug.Log("Posicion del hgueso -----------------"+posicionHueso.position+"----------------------"); //funcionesDeCamara.miraMovedizaCamara (); Instantiate (esfera, posicionHueso.position,posicionHueso.rotation); // Script1.disparo (); /*abtenemos posicion del posicion = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/marco").GetComponent<Transform>(); Debug.Log ("+++++++++++ la poscion del flash es: " + posicion.position + "+++++++++++++++++++");canion*/ /*obtenemos un hueso*/ }
static bool compararArma(controlDeArmasEnemigo armaE,controlDeArmasJugador armaJ ){ bool retVal = false; Debug.Log ("Arma del JUGADOR" + armaJ.wepoType.ToString ()); Debug.Log ("Arma del Enemigo" + armaE.wepoType.ToString()); if(armaE.wepoType.ToString() == armaJ.wepoType.ToString()){ //decider //posibilidad de atacar del 50 % int random=Random.Range(0,11); Debug.Log ("tiene la misma Arma"); if(random<= 5){ Debug.Log ("tiene la misma Arma y ataco con valor "+random); retVal = true; } }else{ if (armaE.wepoType == managerDeArmasEnemigo.WeaponType.Rifle) { Debug.Log ("rifle en el no jugador"); retVal = true; }if(armaJ.wepoType.ToString()== managerDeArmasEnemigo.WeaponType.Pistol.ToString()){ Debug.Log ("el jugador sua una pistola"); retVal = true; } } return retVal; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state //override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here. override public void OnStateIK (Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { control = GameObject.FindGameObjectWithTag ("colt").GetComponent<controlDeArmasJugador> (); animator.SetInteger ("casquillos", 6 - control.municionActual); }