相关疑难解决方法(0)

播放并等待动画/动画师完成播放

在我的脚本中,当玩家位于平台顶部时,我就这样做了.它工作正常.但是现在我想让它一旦起来播放剪辑"Down".

using UnityEngine;
using System.Collections;
using System.Reflection;

public class DetectPlayer : MonoBehaviour {

    GameObject target;

    public void ClearLog()
    {
        var assembly = Assembly.GetAssembly(typeof(UnityEditor.ActiveEditorTracker));
        var type = assembly.GetType("UnityEditorInternal.LogEntries");
        var method = type.GetMethod("Clear");
        method.Invoke(new object(), null);
    }

    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.name == "Platform")
        {
            Debug.Log("Touching Platform");
        }

    }

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.name == "OnTop Detector")
        {
            Debug.Log("On Top of Platform");
            GameObject findGo = GameObject.Find("ThirdPersonController");
            GameObject findGo1 = GameObject.Find("Elevator");
            findGo.transform.parent = findGo1.transform;
            target = GameObject.Find("Elevator");
            target.GetComponent<Animation>().Play("Up");
        }
    }
} …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine

5
推荐指数
1
解决办法
5838
查看次数

标签 统计

c# ×1

unity-game-engine ×1