GetInteger() public method

public GetInteger ( int id ) : int
id int
return int
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(animator.gameObject.GetComponent<Enemy>().indexPos == 0){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(1)").transform.position, GameObject.Find("skillSpawn(1)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy1Attack";
            }
        }

        if(animator.gameObject.GetComponent<Enemy>().indexPos == 1){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(2)").transform.position, GameObject.Find("skillSpawn(2)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy2Attack";
            }
        }

        if(animator.gameObject.GetComponent<Enemy>().indexPos == 2){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(3)").transform.position, GameObject.Find("skillSpawn(3)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy3Attack";

            }
        }
    }
Example #2
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.GetInteger (AnimParameter.state) != state) {
         Debug.Log (animator.GetInteger (AnimParameter.state).
             ToString()+state);
         animator.SetInteger ("state", state);
     }
 }
Example #3
0
    //    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
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        cartucho = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006");
        m =cartucho.GetComponent<SkinnedMeshRenderer>();

        m.enabled = false;
        //Instantiate(flash,);
        casquillos = animator.GetInteger ("casquillos");

        //GameObject Object1 = GameObject.Find ("armas");
        //Component anotherScript = Object1.GetComponent<disparosDelJugador> ();
        disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> ();
        disparo.disparo (3);
        anim = GameObject.Find ("animacionColt44-40").GetComponent<Animator> ();

        anim.SetInteger ("cartuchos",anim.GetInteger("cartuchos")-1);
        //Transform bone = GetComponent<Animator>().avatar.GetBone(BoneType.LeftShoulder);

        objetin = GameObject.FindGameObjectsWithTag ("canionColt");
        posicionHueso = objetin [0].transform;
        Debug.Log("Posicion del hgueso -----------------"+posicionHueso.position+"----------------------");

        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*/
    }
Example #4
0
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if(safeAttack<animator.GetInteger("Attack"))
         animator.SetInteger("Attack",1);
     else
         animator.SetInteger("Attack",0);
 }
    // 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
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        var currentDirection = (Direction)animator.GetInteger("FaceDirection");

        if (animator.GetBool("MeleeAttackBool"))
        {
          animator.SetBool("MeleeAttackBool", false);
          switch (currentDirection)
          {
        case Direction.Up:
          animator.CrossFade("P_Idle_Up", 0.5f);
          break;
        case Direction.Down:
          animator.CrossFade("P_Idle_Down", 0.5f);
          break;
        case Direction.Left:
          animator.CrossFade("P_Idle_Left", 0.5f);
          break;
        case Direction.Right:
          animator.CrossFade("P_Idle_Right", 0.5f);
          break;
          }
        }
        ResetAnimationState(animator);
    }
Example #6
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if(animator.GetInteger("direction") == 3)
     {
         animator.transform.Rotate (0, 180, 0);
     }
 }
Example #7
0
	//called by lvl change
	private void GrabMethods(){ 
		background = GameObject.Find("Background");
		//player = GameObject.Find("Player").GetComponent<PlayerController>();
		scenery = background.GetComponent<Animator>();
		sea =  SeasonExtension.ToSeason(scenery.GetInteger("Season"));
		targets = GetEffectedArray();
	}
 // 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
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if(animator.GetInteger("canAttack") == 0){
         wait (1.0f);
         animator.gameObject.GetComponent<Enemy>().toggle_attack();
     }
 }
        private IEnumerator RandomizeValue()
        {
            var previousValue = statusAnimator.GetInteger("randomState");
            var newValue      = GenerateNewValue(previousValue);

            statusAnimator.SetInteger("randomState", newValue);
            yield return(new WaitForSeconds(Random.Range(timeFrom, timeTo)));

            StartRandomizeValue();
        }
Example #10
0
 /// <summary>
 /// Check drop size (go away or detect)
 /// </summary>
 public static void CheckDrop(Animator animator, int sizeLimitDrop)
 {
     int size = animator.GetInteger("SizeDrop");
     int sizeLimit = sizeLimitDrop;
     if (sizeLimit > 0 && size >= sizeLimit) {
         animator.SetBool("GoAway", true);
     } else if ((sizeLimit <= 0 || size < sizeLimit) && size > 0) {
         animator.SetBool("Detect", true);
     }
 }
Example #11
0
    void Awake()
    {
        _skills = new List<Skills>();
        _utility = new List<Skills>();
        god = GameObject.FindGameObjectWithTag("God").GetComponent<UnifiedSuperClass>();
        skillsController = god.SkillsController;

        anim = transform.parent.gameObject.GetComponent<Animator> ();
        anim.SetInteger ("Skill", 1);
        currentSkill = anim.GetInteger ("Skill");
    }
	 // 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 ();
	}
Example #13
0
	// 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) {
        animator.gameObject.GetComponent<PressStart>().mode = animator.GetInteger("mode");
		poof = animator.gameObject.GetComponentsInChildren<ParticleSystem>();
        foreach (var puff in poof)
        {
            Debug.Log("Puff");
            puff.Play();
        }
        animator.SetBool("flipped", !animator.GetBool("flipped"));
		//UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject (GameObject.FindGameObjectWithTag ("UI Element"));
        //anim.SetInteger("mode", menuNumber);
    }
Example #14
0
 //OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     casquillos = animator.GetInteger("casquillos")-1;
     animator.SetInteger ("casquillos", casquillos);
     cartucho6 = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006");
     m =cartucho6.GetComponent<SkinnedMeshRenderer>();
     m.enabled = false;
     //cartucho6 = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006");
     //cartucho6.GetComponent<Renderer>().enabled = true;
     cartucho0 = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/cartucho_000");
     m0 =cartucho0.GetComponent<SkinnedMeshRenderer>();
     m0.enabled = true;
 }
Example #15
0
 // Use this for initialization
 void Awake()
 {
     buttonDown = false;
     anim = transform.parent.gameObject.GetComponent<Animator> ();
     anim.SetInteger ("Skill", 1);
     currentSkill = anim.GetInteger ("Skill");
     dashSkillLock = false;
     spinSkillLock = false;
     setDashDuration = dashDuration;
     setSpinDuration = spinDuration;
     holsterSword.SetActive(false);
     shield.SetActive (false);
     //linked = false;
 }
Example #16
0
//	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) {
		casquillos = animator.GetInteger ("casquillos");

		//GameObject Object1 = GameObject.Find ("armas");
		//Component anotherScript = Object1.GetComponent<disparosDelJugador> ();
		/*disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> ();
		disparo.disparo ();*/
		anim = GameObject.Find ("animacionColt44-40").GetComponent<Animator> ();

		anim.SetInteger ("cartuchos",anim.GetInteger("cartuchos")-1);




	}
Example #17
0
    //    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
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        //Instantiate(flash,);
        //		casquillos = animator.GetInteger ("casquillos");

        //GameObject Object1 = GameObject.Find ("armas");
        //Component anotherScript = Object1.GetComponent<disparosDelJugador> ();
        disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> ();
        disparo.disparo (.34f);
        anim = GameObject.Find ("Animacionwinchester_94_30-30").GetComponent<Animator> ();

        anim.SetInteger ("cartuchos",anim.GetInteger("cartuchos")-1);

        //		Script1.disparo ();
    }
    object GetParameterValue(Animator anim, AnimatorControllerParameterType type, int nameHash)
    {
        switch (type) {
            case AnimatorControllerParameterType.Bool:
            case AnimatorControllerParameterType.Trigger:
                return anim.GetBool(nameHash);

            case AnimatorControllerParameterType.Float:
                return anim.GetFloat(nameHash);

            case AnimatorControllerParameterType.Int:
                return anim.GetInteger(nameHash);

            default:
                return null;
        }
    }
 public void ResetAnimationState(Animator animator)
 {
     var currentDirection = (Direction)animator.GetInteger("FaceDirection");
     switch (currentDirection)
     {
       case Direction.Up:
     animator.CrossFade("P_Idle_Up", 0.5f);
     break;
       case Direction.Down:
     animator.CrossFade("P_Idle_Down", 0.5f);
     break;
       case Direction.Left:
     animator.CrossFade("P_Idle_Left", 0.5f);
     break;
       case Direction.Right:
     animator.CrossFade("P_Idle_Right", 0.5f);
     break;
     }
 }
Example #20
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (_player == null)
        {
            _player = animator.GetComponent<Player>();
            _animator = animator;
        }

        int attackStack = animator.GetInteger("BaseAttackStack");
        if (attackStack == 2)
            _player.SetKnockdown(true);
        if (++attackStack > 2)
            attackStack = 0;
        animator.SetInteger("BaseAttackStack", attackStack);
        if (_attackStackTimer != null)
            _player.StopCoroutine(_attackStackTimer);
        _attackStackTimer = _player.StartCoroutine(ResetAttackStack());
        animator.SetFloat("AttackSpeed", _player.attackSpeed);
        InputHandler.instance.enabled = true;
    }
Example #21
0
 // Use this for initialization
 void Start ()
 {
     
     animator = GetComponent<Animator>();
     var collector = GetComponentInParent<Collector>();
     if(collector != null)
     {
         if (collector.playerNum == Player.s_localPlayer.pos)
         {
             animator.runtimeAnimatorController = you;
         }
         else
         {
             animator.runtimeAnimatorController = notYou;
         }
     }
     
     previousDirection = animator.GetInteger("Direction");
     initRot = transform.rotation;
 }
Example #22
0
 public static void CopyParamsFrom(this Animator self, Animator from)
 {
     AnimatorControllerData.ControllerData data = AnimatorControllerData.Instance.GetData(from.runtimeAnimatorController.name.GetHashCode());
     AnimatorControllerData.Parameter[] parameters = data.Parameters;
     for (int i = 0; i < parameters.Length; i++)
     {
         AnimatorControllerData.Parameter parameter = parameters[i];
         switch (parameter.ParamType)
         {
         case AnimatorControllerData.ParamType.Bool:
             self.SetBoolReflected(parameter.Name, from.GetBool(parameter.Name));
             break;
         case AnimatorControllerData.ParamType.Int:
             self.SetIntegerReflected(parameter.Name, from.GetInteger(parameter.Name));
             break;
         case AnimatorControllerData.ParamType.Float:
             self.SetFloatReflected(parameter.Name, from.GetFloat(parameter.Name));
             break;
         }
     }
 }
Example #23
0
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        int size = animator.GetInteger("SizeDrop");
        int sizeLimit = commonParameters.sizeLimitDrop;
        if (sizeLimit > 0 && size >= sizeLimit) {
            animator.SetBool("GoAway", true);
            return;
        }

        if (commonParameters.drop == null) {
            return;
        }
        _dropChased = commonParameters.drop;

        // Saves the original position
        Vector3 move = Vector3.zero;
        Vector3 originalPosition = commonParameters.enemy.transform.position;
        Vector3 finalPosition = AIMethods.MoveEnemy(originalPosition, commonParameters.drop.transform.position,
                                    FollowType.MoveTowards, commonParameters.onFloor, parameters.speed);
        AIMethods.RotateEnemyTowards(commonParameters.enemy, parameters.fixedRotation, commonParameters.initialRotationEnemy,
                            parameters.rotationVelocity, originalPosition, finalPosition);

        Vector3 direction = (finalPosition - originalPosition);
        //give preference on y axis to not let the drop run away
        direction.x *= 0.5f;
        direction.y *= 1.5f;
        direction=direction.normalized;

        //move the entity
        move = direction * parameters.speed * Time.deltaTime;
        //set gravity and move
        if (commonParameters.onFloor) {
            move += (commonParameters.enemy.transform.up * -1) * 25 * Time.deltaTime;
        }
        _controller.Move(move);
    }
 private object GetParameterValue(int i, AnimatorControllerParameterType type, Animator animator) {
     switch (type) {
         case AnimatorControllerParameterType.Float:
             return animator.GetFloat(i);
         case AnimatorControllerParameterType.Int:
             return animator.GetInteger(i);
         case AnimatorControllerParameterType.Bool:
             return animator.GetBool(i);
         case AnimatorControllerParameterType.Trigger:
             return animator.GetBool(i);
         default:
             return null;
     }
 }
Example #25
0
 public override void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
 {
     animator.SetInteger("RandomSelector", Random.Range(0,2));
     Debug.Log ("anim: " + animator.GetInteger ("RandomSelector"));
 }
Example #26
0
	 // 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) {
	//
	//}

    void OnStateUpdate(Animator animator)
    {
        if (animator.GetInteger("State") == 1) animator.SetInteger("State", 2);
        if (animator.GetInteger("State") == 3) animator.SetInteger("State", 0);
    }
Example #27
0
 public bool Test(Animator animator)
 {
     if (this.conditions.Count == 0)
     {
         return true;
     }
     for (int i = 0; i < this.conditions.Count; i++)
     {
         EventConditionEntry eventConditionEntry = this.conditions[i];
         if (!string.IsNullOrEmpty(eventConditionEntry.conditionParam))
         {
             switch (eventConditionEntry.conditionParamType)
             {
             case EventConditionParamTypes.Int:
             {
                 int integer = animator.GetInteger(eventConditionEntry.conditionParam);
                 switch (eventConditionEntry.conditionMode)
                 {
                 case EventConditionModes.Equal:
                     if (integer != eventConditionEntry.intValue)
                     {
                         return false;
                     }
                     break;
                 case EventConditionModes.NotEqual:
                     if (integer == eventConditionEntry.intValue)
                     {
                         return false;
                     }
                     break;
                 case EventConditionModes.GreaterThan:
                     if (integer <= eventConditionEntry.intValue)
                     {
                         return false;
                     }
                     break;
                 case EventConditionModes.LessThan:
                     if (integer >= eventConditionEntry.intValue)
                     {
                         return false;
                     }
                     break;
                 case EventConditionModes.GreaterEqualThan:
                     if (integer < eventConditionEntry.intValue)
                     {
                         return false;
                     }
                     break;
                 case EventConditionModes.LessEqualThan:
                     if (integer > eventConditionEntry.intValue)
                     {
                         return false;
                     }
                     break;
                 }
                 break;
             }
             case EventConditionParamTypes.Float:
             {
                 float @float = animator.GetFloat(eventConditionEntry.conditionParam);
                 EventConditionModes conditionMode = eventConditionEntry.conditionMode;
                 if (conditionMode != EventConditionModes.GreaterThan)
                 {
                     if (conditionMode == EventConditionModes.LessThan)
                     {
                         if (@float >= eventConditionEntry.floatValue)
                         {
                             return false;
                         }
                     }
                 }
                 else if (@float <= eventConditionEntry.floatValue)
                 {
                     return false;
                 }
                 break;
             }
             case EventConditionParamTypes.Boolean:
             {
                 bool @bool = animator.GetBool(eventConditionEntry.conditionParam);
                 if (@bool != eventConditionEntry.boolValue)
                 {
                     return false;
                 }
                 break;
             }
             }
         }
     }
     return true;
 }
Example #28
0
 void OnStateExit(Animator animator)
 {
     //sword = GameObject.Find("Sword");
     animator.gameObject.tag = "Player";
     if(animator.GetInteger("Weapon") == 1 || animator.GetInteger("Weapon") == 3) animator.SetInteger("Attack", -1);
 }
Example #29
0
    // 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) {
	//
	//}

    void OnStateUpdate(Animator animator)
    {
        if (animator.GetInteger("Weapon") == 1 || animator.GetInteger("Weapon") == 3) animator.SetInteger("Attack", 0);
    }
Example #30
0
 void Start()
 {
     anim = transform.parent.gameObject.GetComponent<Animator> ();
     anim.SetInteger ("Skill", 1);
     currentSkill = anim.GetInteger ("Skill");
     hooked = false;
     anim.SetBool ("Holding", false);
 }
Example #31
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Application.LoadLevel(animator.GetInteger("LevelId"));
 }