当前位置: 首页>>代码示例>>C#>>正文


C# Animator.Play方法代码示例

本文整理汇总了C#中Animator.Play方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.Play方法的具体用法?C# Animator.Play怎么用?C# Animator.Play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Animator的用法示例。


在下文中一共展示了Animator.Play方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadPuzzleSelectMenu

 IEnumerator LoadPuzzleSelectMenu(GameObject puzzleGamePanel, Animator puzzleGamePanelAnim) {
     puzzleLevelSelectPanel.SetActive(true);
     puzzleGamePanelAnim.Play("Slidein");
     puzzleGamePanelAnim.Play("Slideout");
     yield return new WaitForSeconds(1f);
     puzzleGamePanel.SetActive(false);
 }
开发者ID:thanhchungbtc,项目名称:Udemy_Unity_MemoryGame,代码行数:7,代码来源:LoadPuzzleGame.cs

示例2: Movement

	void Movement()
	{
		var bit = GameObject.Find("Bit");
		anim = gameObject.GetComponent<Animator> ();

		if(Input.GetKey (KeyCode.D)) {
			bit.transform.Translate (Vector2.right * speed * (Time.deltaTime));
			anim.Play ("Bit_WalkRight");

		}

		if (Input.GetKey (KeyCode.A)) {
			bit.transform.Translate (-Vector2.right * speed * (Time.deltaTime));
			anim.Play ("Bit_WalkLeft");	
		}

		if (Input.GetKey (KeyCode.W)) {
			bit.transform.Translate (Vector2.up * speed * (Time.deltaTime));
			anim.Play ("Bit_WalkUp");
		}

		if (Input.GetKey (KeyCode.S)) {
			bit.transform.Translate (Vector2.down * speed * (Time.deltaTime));
			anim.Play ("Bit_WalkDown");
		}
	}
开发者ID:dlp4w,项目名称:wedontknow,代码行数:26,代码来源:BitControl1.cs

示例3: Start

    // Use this for initialization
    void Start()
    {
        isHit = false;

        animator = GetComponent<Animator>();
        //animator.StartPlayback();

        animator.SetBool("IsIdle", startIdle);

        isWalking = !startIdle;
        if(startIdle)
        {
            animator.Play("SpiderIdle", -1, 1f);
        }
        else
        {
            animator.Play("SpiderWalk", -1, 1f);
        }

        startPoint = transform.position;
        endPoint = new Vector3(transform.position.x + (startTowardsLeft ? -distanceToTravel: distanceToTravel) / 72f, transform.position.y, transform.position.z);

        totalDistanceTravelled = 0f;

        if(startTowardsLeft)
        {
            transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            Vector3 tmp = endPoint;
            endPoint = startPoint;
            startPoint = tmp;
            startTowardsLeft = !startTowardsLeft;
        }
        Debug.Log(startPoint.ToString() + " " + endPoint.ToString());
    }
开发者ID:Sebastianlyw,项目名称:ragdoll-blaster,代码行数:35,代码来源:SpiderController.cs

示例4: Start

 void Start()
 {
     anim = GetComponent<Animator>();
     if(PlayerPrefs.GetString("escaleraOpen") == "closed"){
         anim.Play ("escaleraClosed");
     }else{
         anim.Play ("escaleraOpened");
         HabilitarSubida();
         this.collider2D.enabled = false;
     }
     //PlayerPrefs.SetString("playerInstance","SwampHouse3");
     animations = (Animations)GameObject.FindObjectOfType(typeof(Animations));
     playerMove = (PlayerMove)GameObject.FindObjectOfType(typeof(PlayerMove));
 }
开发者ID:VictorVaxb,项目名称:SurvivalCurse,代码行数:14,代码来源:Escalera.cs

示例5: Start

 void Start()
 {
     playerMove = (PlayerMove)GameObject.FindObjectOfType(typeof(PlayerMove));
     animations = (Animations)GameObject.FindObjectOfType(typeof(Animations));
     gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
     inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
     anim = GetComponent<Animator>();
     if(PlayerPrefs.GetInt("doorInOpen") == 0){
         anim.Play("doorInClosed");
     }else{
         this.collider2D.enabled = false;
         this.gameObject.tag = "Untagged";
         anim.Play("doorInOpened");
     }
 }
开发者ID:VictorVaxb,项目名称:SurvivalCurse,代码行数:15,代码来源:DoorIn.cs

示例6: Init

    public void Init(PowerupManager.types type)
    {
        if(Data.Instance.musicManager.volume==1)
            Events.OnMusicVolumeChanged(0.2f);
        anim = GetComponent<Animator>();
        anim.updateMode = AnimatorUpdateMode.UnscaledTime;
        Invoke("onComplete", 0.1f);

        anim.Play("powerupSign", 0, 0);

        switch (type)
        {
            case PowerupManager.types.CHUMBO:
                title.text = "MEGA-CHUMBO";
                desc.text = "TREMENDO CHUMBO + 1 AGUANTE";
                break;
            case PowerupManager.types.GIL:
                title.text = "GIL-POWA";
                desc.text = "PODER DE EXTRA PUNGUEO + 1 AGUANTE";
                break;
            case PowerupManager.types.MOTO:
                title.text = "RATI-CICLO";
                desc.text = "APLASTA COBANIS Y CIVILES + 1 AGUANTE";
                break;
        }
        Time.timeScale = 0.05f;
    }
开发者ID:pontura,项目名称:PungaRaid,代码行数:27,代码来源:PowerupSign.cs

示例7: CollectRing

 public void CollectRing()
 {
     _animator = GetComponent<Animator>();
     _animator.Play("Ring_Hit");
     if (!_collected) { GetComponent<AudioSource>().Play(); }
     _collected = true;
 }
开发者ID:Azerothian,项目名称:Sonic-2,代码行数:7,代码来源:Ring.cs

示例8: Start

    void Start()
    {
        toggles = GameObject.Find("TowerChoice").GetComponentsInChildren<Toggle>();
        choiceTowers = new Dictionary<TglTower, Tower>();
        retrieveChoiceTowers();
        DisableChoices();

        title = GameObject.Find("txtTitle");
		title.SetActive(false);
        smallTitle = GameObject.Find("txtSmallTitle");
        tiltShift = GameObject.Find("Main Camera").GetComponent<UnityStandardAssets.ImageEffects.TiltShift>();
        spawnLaps = 2;
        spawner = GameObject.Find("Spawn").GetComponentInChildren<Spawn>();
		step = Step.STARTING;
        shakeAmount = 0.1F;
        shakeTimer = 1F;

        HideTowerDetails();
        
        btnNextWave.onClick.AddListener(EndConstructionTime);
        nextWave = GameObject.Find("btnNextWave");
        nextWave.SetActive(false);

		animator = ((Animator)GetComponent<Animator>());
		topCam = (Camera) topCamObject.GetComponent<Camera> ();

		animator.Play("CameraStartAnim", -1, 0F);
		startTimer = Time.time;
    }
开发者ID:Samoustique,项目名称:TowerDefense,代码行数:29,代码来源:GameManager.cs

示例9: Start

 // Use this for initialization
 void Start()
 {
     eating = true;
     pacman = GameObject.Find("pacman");
     Laika = GetComponent<Animator>();
     Laika.Play("Eating");
 }
开发者ID:Cosmoose,项目名称:SP15_SU08_PacMan,代码行数:8,代码来源:LaikaAnimate.cs

示例10: Start

 void Start()
 {
     anim = GetComponent<Animator>();
     animations = (Animations)GameObject.FindObjectOfType(typeof(Animations));
     playerMove = (PlayerMove)GameObject.FindObjectOfType(typeof(PlayerMove));
     anim.Play("ramasIdle");
 }
开发者ID:VictorVaxb,项目名称:SurvivalCurse,代码行数:7,代码来源:Ramas.cs

示例11: Activate

 public void Activate(panelState state)
 {
     anim = gameObject.GetComponent<Animator>();
     gameObject.SetActive(true);
     currentState = state;
     anim.Play("PopupOpen");
 }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:7,代码来源:SelectionInfoPanel.cs

示例12: Start

 // Use this for initialization
 void Start()
 {
     //swordEdge = GetComponent<Ray> ();
     pos = GetComponent<Transform> ();
     anim = GetComponent<Animator> ();
     anim.Play ("idle");
 }
开发者ID:tdetoy,项目名称:unity-repo,代码行数:8,代码来源:AttackAndDefend.cs

示例13: Start

    // Use this for initialization
    void Start()
    {
        animator = GetComponent<Animator>();

        animator.Play("DayNight", -1, Game.CurrentTime / 24f);
        animator.speed = 0f;
    }
开发者ID:raimis001,项目名称:raWorld,代码行数:8,代码来源:guiDayNight.cs

示例14: Start

	/*=========================== Methods ===================================================*/

	/*=========================== Start() ===================================================*/

	void Start () {
	
		// get reference to DefenceTower object
		defenceTower = gameObject.GetComponentInParent<DefenceTower> ().defenceTower;

		// set the projectile speed
		projectileSpeed = defenceTower.GetComponent<DefenceTower>().projectileSpeed;

		// set projectile damage
		projectileDamage = defenceTower.GetComponent<DefenceTower>().projectileDamage;

		// get the reference to the target enemy
		target = defenceTower.GetComponent<DefenceTower> ().enemyTarget;

		// set animation to not finished
		animationFinished = false;

		// get reference to animator
		anim = GetComponent<Animator>();

		if (defenceTower.tag == "TowerLvl4") {

			// run animation Projectile gets bigger
			anim.Play("ProjectileGetsBigger", 0, 0f);

		} else { // if not lvl 4 tower

			// animation does not play
			animationFinished = true;

		} // if

	} // Start()
开发者ID:Ross-Byrne,项目名称:PartyCrashingOgresTD,代码行数:37,代码来源:Projectile.cs

示例15: ClickToLogin

 public void ClickToLogin()
 {
     animator = GameObject.Find("/Login").GetComponent<Animator>();
     hint.text = "";
     ar.pushToList("CloseRegister");
     animator.Play("CloseRegister");
 }
开发者ID:ivan-lin1993,项目名称:JiaBong,代码行数:7,代码来源:LoginSlide.cs


注:本文中的Animator.Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。