SetInteger() public method

public SetInteger ( int id, int value ) : void
id int
value int
return void
コード例 #1
0
ファイル: Bullets.cs プロジェクト: julianpoy/HackPoly2016
	// Use this for initialization
	void Start () {

		//Get a component reference to the Character's animator component
		animator = GetComponent<Animator>();
		render = GetComponent<SpriteRenderer>();

		//Get the rigid body on the prefab
		bullBody = GetComponent<Rigidbody2D>();

		//Set our bullet strength and speed
		strength = 4;
		speed = 40;

		//Go after our player!
		player = GameObject.Find("Player").GetComponent<Player>();

		//Get our Player current Direction
		if (player.getDirection () > 0 ||
			(player.getDirection() == 0 && player.getLastDirection() > 0 )) {
			animator.SetInteger ("Direction", 1);
			playerRight = true;
		} else {
			playerRight = false;
			animator.SetInteger ("Direction", -1);
		}

		//Play our shooting sound
		shoot = GameObject.Find ("Shoot").GetComponent<AudioSource> ();

			shoot.Play ();

		//Get our camera script
		actionCamera = Camera.main.GetComponent<ActionCamera>();
	}
コード例 #2
0
ファイル: AttackNextStage.cs プロジェクト: Baensi/Assets
 // 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);
 }
コード例 #3
0
	// Use this for initialization
	void Start(){
		anim = GetComponent<Animator> ();
		dispParoDelJugador = GetComponentInParent<disparosDelJugador> ();
		anim.SetInteger ("cartuchos", municionActual);
		anim.SetInteger ("reservas", municionReservas);

		muestraMunicion ();
	}
コード例 #4
0
        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();
        }
コード例 #5
0
 public override void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
 {
     if(states.Length == 0)
         animator.SetInteger(parametrName, 0);
     else
     {
         int index = Random.Range(0, states.Length);
         animator.SetInteger(parametrName, states[index]);
     }
 }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        // Get the animator component
        animator = GetComponent<Animator>();
        animator.SetInteger("status", status);
        animator.SetInteger("asteroidClass", asteroidClass);

        // Create a random initial velocity (also an apoapsis)
        initialVector.Normalize();
        transform.GetComponent<Rigidbody2D>().velocity = initialSpeed * initialVector;
    }
コード例 #7
0
 void Start()
 {
     rb2d = gameObject.GetComponent<Rigidbody2D>();
     anim = gameObject.GetComponent<Animator>();
     if (facingLeft)
     {
         anim.SetInteger("walkingAnimation", -1);
     }
     else
     {
         anim.SetInteger("walkingAnimation", 1);
     }
 }
コード例 #8
0
 //AnimState key
 //1 goes from growth/shine to idle
 //2 goes from idle to shine
 //3 goes from idle/shine to disappear
 // Use this for initialization
 void Awake()
 {
     freezeAnimator = GetComponent<Animator> ();
     freezeAnimator.SetInteger ("AnimState", 0);
     lifeTimer = 6f;
     StartCoroutine(Disappear());
 }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     killCounter = 0;
     mainLoop = (GameController) GameObject.FindGameObjectWithTag ("scripts").GetComponent(typeof(GameController));
     animator = this.GetComponent<Animator> ();
     animator.SetInteger ("Behavior", 0);	// bounce
 }
コード例 #10
0
 void Start()
 {
     maxHealth = 6;
     animator = this.GetComponent<Animator> ();
     animator.SetInteger ("fenceType", 0);
     animator.SetBool ("damaged", false);
 }
コード例 #11
0
ファイル: Bulet.cs プロジェクト: terdened/Tanks
 void Awake()
 {
     animationState = 0;
     animator = (Animator)GetComponent<Animator> ();
     animator.SetInteger ("State", animationState);
     networkView = GetComponent<NetworkView> ();
 }
コード例 #12
0
        public override void OnEnter()
        {
            animator = ownerDefault.GetComponent <UnityEngine.Animator> ();
            animator.SetInteger(hash, Mathf.RoundToInt(owner.GetValue(value)));

            Finish();
        }
コード例 #13
0
ファイル: DoorScene.cs プロジェクト: briveramelo/Cube-Quest
 void Awake()
 {
     doorAnimator = GetComponent<Animator> ();
     if (appear) {
         doorAnimator.SetInteger("AnimState",0);
         doorAnimator.speed = 0f;
     }
     else{
         doorAnimator.SetInteger("AnimState",1);
         doorAnimator.speed = 1f;
     }
     if (name == "Door_End") {
         levelComplete = transform.parent.FindChild ("LevelComplete").GetComponent<SpriteRenderer> ();
     }
     allKnow = GameObject.Find ("theOmniscient").GetComponent<GatherAllKnowledge>();
 }
コード例 #14
0
ファイル: HitAnimation.cs プロジェクト: yunhoyong/test
 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if(stateInfo.normalizedTime >= 1.0f)
     {
         animator.SetInteger("Hit", 0);
     }
 }
コード例 #15
0
ファイル: HeartScript.cs プロジェクト: dannielle/heart-shake
 void Start()
 {
     anim = GetComponent<Animator> ();
     feels = State.Idle;
     needs = State.Punch;
     anim.SetInteger ("feelsState", 0);
 }
コード例 #16
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) {
        animator.SetInteger("idleNextAnimation", 0);
        rndTime = UnityEngine.Random.Range(0.0f, 10.0f);
        startTime = Time.time;
        twinkleTime = startTime + rndTime;
        this.animator = animator;
	}
コード例 #17
0
		public override void OnEnter ()
		{
			animator = ownerDefault.GetComponent<UnityEngine.Animator> ();
			animator.SetInteger (hash,  Mathf.RoundToInt(owner.GetValue(value)));

			Finish ();
		}
コード例 #18
0
ファイル: Target.cs プロジェクト: UnBiHealth/fisiogame
 void Start()
 {
     hp = 3;
     animator = GetComponent<Animator>();
     animator.SetInteger("hp", hp);
     parallaxLayer = GetComponent<SpriteRenderer>().sortingOrder;
 }
コード例 #19
0
ファイル: disparoColt44.cs プロジェクト: JonaSilva/prueba
    //    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*/
    }
コード例 #20
0
ファイル: Sekigaekun.cs プロジェクト: Joe-noh/sekigae
    // Use this for initialization
    void Start()
    {
        animator = GetComponent<Animator>();

        direction = Random.Range(0, 2) == 0 ? 1 : -1;
        animator.SetInteger("dir", direction);
    }
コード例 #21
0
    /// <summary>
    /// Will set the Animation with the supplied parameter
    /// </summary>
    /// <param name="animation">The Animation to set</param>
    /// <param name="animator">The animator to get the Animations</param>
    /// <param name="parameter">The value for the Animation</param>
    public static void setAnimationTypeAndValue(Animation animation, Animator animator, object value)
    {
        if(value == null) {
            return;
        }

        //Grab what Type of parameter
        AnimatorControllerParameter param = getAnimatorControllerParameter(animation, animator);

        //If param doesn't exist, just get out
        if(param == null) {
            return;
        }

        switch(param.type) {
            case AnimatorControllerParameterType.Bool:
                animator.SetBool(animation.ToString(), (bool)value);
                break;
            case AnimatorControllerParameterType.Float:
                animator.SetFloat(animation.ToString(), (float)value);
                break;
            case AnimatorControllerParameterType.Int:
                animator.SetInteger(animation.ToString(), (int)value);
                break;
            case AnimatorControllerParameterType.Trigger:
                animator.SetTrigger(animation.ToString());
                break;
            default:
                break;
        }
    }
コード例 #22
0
	// Use this for initialization
	void Start () {
        player = GameObject.Find("Squirrel").GetComponent<Player>();

        rigidbody_2d = this.GetComponent<Rigidbody2D>();

        animator = this.GetComponent<Animator>();

        if (steps != 0)
        {
            animator.SetInteger("AnimationState", 2);
        }
        else
        {
            animator.SetInteger("AnimationState", 0);
        }
	}
コード例 #23
0
ファイル: attackingBoss.cs プロジェクト: luliz/brazilball
 // 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)
 {
     //spearCollider.enabled = false;
     animator.SetInteger ("status", 0);
     animator.gameObject.GetComponent<Boss> ().attacking = false;
     animator.gameObject.GetComponent<Boss> ().estado = 1;
 }
コード例 #24
0
ファイル: asteroid.cs プロジェクト: heldersepu/hs-unity
 void Start()
 {
     Quaternion rot = Random.rotation;
     vR = rot.z; vX = rot.x/10; vY = rot.y/10;
     anim = GetComponent<Animator>();
     anim.SetInteger ("aster", Random.Range (0, 3));
 }
コード例 #25
0
ファイル: UnitProfile.cs プロジェクト: iamau555/LittleHeroes
    // Use this for initialization
    public void Awake()
    {
        // Random type from 0-2
        // red = 0, blue = 1, green = 2;
        switch ((int)Random.Range (0, 3)) {
        case 0:
            type = TYPE_RED;
            break;
        case 1:
            type = TYPE_GREEN;
            break;
        default :
            type = TYPE_BLUE;
            break;
        }

        anim = GetComponent<Animator> ();
        anim.SetInteger ("Type", type);

        // randomly seperate random stat to each stat plus START_STATS = 10
        hp = START_STATS + (int)Random.Range (0, bonusStat);
        bonusStat -= (hp - START_STATS);
        sword = START_STATS + (int)Random.Range (0, bonusStat);
        bonusStat -= (sword - START_STATS);
        shield = START_STATS + bonusStat;
    }
コード例 #26
0
ファイル: PlayerControl.cs プロジェクト: rogerdv/keyw
 // Use this for initialization
 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     anim = GetComponentInChildren<Animator>();
     anim.SetInteger ("CharacterState", (int)CharacterState.Idle);
     //myTransform = transform;
 }
コード例 #27
0
	override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {

		//called on the last frame of a transition to another state.

		//reset the options
		animator.SetInteger("optionselect", 0);
	}
コード例 #28
0
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator>();
     parameterId = Animator.StringToHash(parameterName);
     int newAnimation = (int) Random.Range(0, numAnimations);
     anim.SetInteger(parameterId, newAnimation);
 }
コード例 #29
0
ファイル: Dude.cs プロジェクト: rowenar11/digiforge
    // Use this for initialization
    void Start()
    {
        animator = this.GetComponent<Animator>();
        animator.SetInteger("Direction", (int)DIRECTIONS.DOWN);

        StartCoroutine(waitInit());
    }
コード例 #30
0
ファイル: PlayerWolfShadow.cs プロジェクト: EdZed/Howl
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator> ();
     playerWolfShadow = GameObject.Find("playerWolfShadow");
     playerWolf = GameObject.Find("playerWolf");
     anim.SetInteger ("AnimState", 0);
     rb2DplayerWolf = playerWolfShadow.GetComponent<Rigidbody2D>();
 }
コード例 #31
0
	// Use this for initialization
	void Start () {
		//transform.position = new Vector3(playerX, playerY);
		rb2D = GetComponent<Rigidbody2D>();
		anim = GetComponent<Animator>();
		Direction = 0;
		anim.SetInteger ("Direction",Direction);
		anim.SetBool ("Move", false);
	}
コード例 #32
0
ファイル: kevinMonument.cs プロジェクト: mrin17/GameJamF15
 // Use this for initialization
 void Start()
 {
     mySR = GetComponent<SpriteRenderer> ();
     childSR = transform.GetChild(0).GetComponent<SpriteRenderer> ();
     myAnim = GetComponent<Animator> ();
     childAnim = transform.GetChild(0).GetComponent<Animator> ();
     childAnim.SetInteger("level", 1);
 }
コード例 #33
0
            public static bool AnimeParamSet(
                UnityEngine.Animator animator,
                string name,
                object value,
                AnimatorControllerParameterType type)
            {
                switch (type - 1)
                {
                case 0:
                    animator.SetFloat(name, (float)value);
                    break;

                case 2:
                    animator.SetInteger(name, (int)value);
                    break;

                case 3:
                    animator.SetBool(name, (bool)value);
                    break;

                default:
                    if (type != 9)
                    {
                        return(false);
                    }
                    switch (value)
                    {
                    case null:
                        animator.ResetTrigger(name);
                        break;

                    case bool flag:
                        if (flag)
                        {
                            animator.SetTrigger(name);
                            break;
                        }
                        animator.ResetTrigger(name);
                        break;

                    case int num:
                        if (num != 0)
                        {
                            animator.SetTrigger(name);
                            break;
                        }
                        animator.ResetTrigger(name);
                        break;

                    default:
                        animator.SetTrigger(name);
                        break;
                    }
                    break;
                }
                return(true);
            }
コード例 #34
0
    void CombatAnimations()
    {
        bool attack       = ginoController.attackInput;
        bool heavyAttack  = ginoController.heavyInput;
        bool heavyAttack2 = ginoController.heavy2Input;

        //BASIC COMBOS
        if (attack)
        {
            if (animator.GetCurrentAnimatorStateInfo(0).IsName("Uppercut"))
            {
                attackCount = 1;
            }

            if (animator.GetCurrentAnimatorStateInfo(0).IsName("Slap"))
            {
                attackCount = 2;
            }
        }
        if (heavyAttack)
        {
            if (animator.GetCurrentAnimatorStateInfo(0).IsName("Slap") && attackCount != 2)
            {
                attackCount = 3;
            }
        }
        if (animator.GetCurrentAnimatorStateInfo(0).IsName("ComboEnd"))
        {
            attackCount = 0;
        }

        //HEAVY ATTACK
        if (heavyAttack)
        {
            startTimer = true;
        }
        if (startTimer && heavyAttack2)
        {
            attackTimer += Time.deltaTime;
            if (attackTimer > 0.5f)
            {
                animator.SetBool("heavyAttack", true);
                startTimer = false;
            }
        }
        else
        {
            attackTimer = 0;
            animator.SetBool("heavyAttack", false);
        }


        animator.SetInteger("attackCount", attackCount);
        animator.SetBool("attack", attack);
        animator.SetFloat("attackTimer", attackTimer);
    }
コード例 #35
0
        public void SetAnimatorParameter()
        {
            if (!animator.enabled || !animator.gameObject.activeInHierarchy)
            {
                if (LogDebug)
                {
                    UnityEngine.Debug.Assert(animator.enabled && animator.gameObject.activeInHierarchy,
                                             "Setting the animator parameter while the animator is disabled may not register the change", this);
                }

                return;
            }


            if (isUnsafe)
            {
                return;
            }

            switch (ParameterType)
            {
            case AnimatorControllerParameterType.Float:
                animator.SetFloat(ParameterID, FloatValue.Value);
                break;

            case AnimatorControllerParameterType.Int:
                animator.SetInteger(ParameterID, IntValue.Value);
                break;

            case AnimatorControllerParameterType.Bool:
                animator.SetBool(ParameterID, BoolValue.Value);
                break;

            case AnimatorControllerParameterType.Trigger:
                animator.SetTrigger(ParameterID);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (PreventFewTriggersPerFrame)
            {
                StartCoroutine(MakeUnsafeTillEndOfFrame());
            }

            if (LogDebug)
            {
                UnityEngine.Debug.Log("Parameter Set", this);
            }
        }
コード例 #36
0
        public void SetAnimatorParameter(UnityEngine.Animator animator)
        {
            switch (ParameterType)
            {
            case AnimatorControllerParameterType.Float:
                animator.SetFloat(ParameterID, FloatValue.Value);
                break;

            case AnimatorControllerParameterType.Int:
                animator.SetInteger(ParameterID, IntValue.Value);
                break;

            case AnimatorControllerParameterType.Bool:
                animator.SetBool(ParameterID, BoolValue.Value);
                break;

            case AnimatorControllerParameterType.Trigger:
                animator.SetTrigger(ParameterID);
                break;
            }
        }
コード例 #37
0
            public static bool AnimeParamSet(UnityEngine.Animator animator, string name, object value)
            {
                switch (value)
                {
                case float num:
                    animator.SetFloat(name, num);
                    break;

                case int num:
                    animator.SetInteger(name, num);
                    break;

                case bool flag:
                    animator.SetBool(name, flag);
                    break;

                default:
                    return(false);
                }
                return(true);
            }
コード例 #38
0
 public override void OnEnter()
 {
     animator.SetInteger(hash, value);
     Finish();
 }