示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        pl = FindObjectOfType <placar>();

        render       = GetComponent <MeshRenderer>();
        DefaultColor = render.material.color;

        var tryGetAnim = GetComponent <Animator>();

        if (tryGetAnim == null)
        {
            var tryTwoorMore = GetComponentsInChildren <Animator>();

            if (tryTwoorMore.Length > 1)
            {
                var rnd = Random.Range(0, tryTwoorMore.Length);
                Anim = tryTwoorMore[rnd];
            }
            else if (tryTwoorMore.Length == 1)
            {
                Anim = tryTwoorMore[0];
            }
        }
        else
        {
            Anim = tryGetAnim;
        }
    }
示例#2
0
 void Start()
 {
     p = this;
 }