private string ChildPath(GameObject obj, bool sep = false)
        {
            if (_animatorObject == null)
            {
                throw new UnityException("Please assign Referenced Animator (Root) first!");
            }

            if (obj == _animatorObject.gameObject)
            {
                return("");
            }

            else
            {
                if (obj.transform.parent == null)
                {
                    throw new UnityException("Object must belong to " + _animatorObject.ToString() + "!");
                }

                else
                {
                    return(ChildPath(obj.transform.parent.gameObject, true) + obj.name + (sep ? "/" : ""));
                }
            }
        }
Exemple #2
0
 override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Debug.Log("MecanimSpiritClicked: " + animator.ToString() + ", si: " + stateInfo.ToString());
     animator.SetBool("_PlayingUnlockAnim", false);
     animator.SetBool("_AnimFinished", true);
     animator.ResetTrigger("_TriggerClicked");
 }
Exemple #3
0
    private void Start()
    {
        // Play the sitting down animation
        Animator animator = gameObject.GetComponent <Animator>();

        animator.SetBool("SitDown", true);
        Debug.Log("animator is: " + animator.ToString());
    }
Exemple #4
0
    // Start is called before the first frame update
    private void Start()
    {
        rightHandAnimator = RightHand.GetComponent <Animator>();

        leftHandAnimator = LeftHand.GetComponent <Animator>();

        Debug.Log("Right Hand Animator = " + rightHandAnimator.ToString());
        Debug.Log("Left Hand Animator = " + leftHandAnimator.ToString());
    }
Exemple #5
0
 public string GetDescription()
 {
     if (animatorRef == null)
     {
         return(animatorVal.ToString());
     }
     else
     {
         return(animatorRef.key);
     }
 }
Exemple #6
0
    bool m_Crouching;                   //are we ducking

    void Start()
    {
        m_Animator = GetComponent <Animator>();
        Debug.Log(m_Animator.ToString());
        m_Rigidbody               = GetComponent <Rigidbody>();
        m_Capsule                 = GetComponent <CapsuleCollider>();
        m_CapsuleHeight           = m_Capsule.height;
        m_CapsuleCenter           = m_Capsule.center;
        m_Rigidbody.constraints   = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
        m_OrigGroundCheckDistance = m_GroundCheckDistance;
    }
Exemple #7
0
 public string GetDescription()
 {
     if (animatorRef == null)
     {
         return(animatorVal != null?animatorVal.ToString() : "Null");
     }
     else
     {
         return(animatorRef.Key);
     }
 }
    private void HierarchyItem(int instanceID, Rect selectionRect)
    {
        Rect r = new Rect(selectionRect);

        r.x     = r.width - 20;
        r.width = 18;
        if (markedObjects == instanceID)
        {
            GUI.Label(r, currenAnimator.ToString());
        }
    }
    private void Awake()
    {
        //if (current == null)
        //{
        // current = this;
        // }
        RB   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
        if (currentRB == null)
        {
            //currentRB = RB;
        }

        //This is called when bullets are made, only once per bullet
        Debug.Log("AWAKE " + GetInstanceID() + " RB: " + RB.ToString() + " Anim: " + anim.ToString());
    }
    void AnimPlay(PlayerAnimations An, bool Animbool, float amount)
    {
        switch (An)
        {
        //Forcibly Play an Animation
        case PlayerAnimations.An_GrappleDash:
        case PlayerAnimations.An_Idle:
        case PlayerAnimations.An_Jump:
        case PlayerAnimations.An_Moving:
        case PlayerAnimations.An_Shoot:
        case PlayerAnimations.An_Stagger:
            Anim.Play(Anim.ToString());
            break;

        //Bools
        case PlayerAnimations.P_Grounded:
        case PlayerAnimations.P_Invul:
        case PlayerAnimations.P_HoldingGrapple:
            Anim.SetBool(An.ToString(), Animbool);
            break;

        //Triggers
        case PlayerAnimations.P_GrappleHit:
        case PlayerAnimations.P_Staggered:
            Anim.SetTrigger(An.ToString());
            break;

        //Floats
        case PlayerAnimations.P_xSpeed:
        case PlayerAnimations.P_ySpeed:
            Anim.SetFloat(An.ToString(), amount);
            break;

        default:
            Debug.LogError(An.ToString() + " | is not a supported within this animator");
            break;
        }
    }
Exemple #11
0
    private void Start()
    {
        // Play the sitting down animation
        Animator animator = gameObject.GetComponent <Animator>();

        animator.SetBool("SitDown", true);
        Debug.Log("animator is: " + animator.ToString());

        Scene currScene = SceneManager.GetActiveScene();

        if (currScene.buildIndex == (int)SceneIndexes.TUT_RETURN)
        {
            idx = 0; // always order eggplant in return_tut_restaurant scene
        }
        else
        {
            idx = Random.Range(0, dishNames.Length); // set the idx here, it was 0 by default
        }

        foodText.text  = dishNames[idx];
        dishImg.sprite = dishImages[idx];
        orderUI.SetActive(true);
    }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("!!! Hello Hello!");
        XmlWriterSettings settings = new XmlWriterSettings();

        settings.Indent      = true;
        settings.CloseOutput = true;
        settings.IndentChars = "    ";
        settings.Encoding    = Encoding.UTF8;
        XmlWriter writerXml = XmlWriter.Create("UnityAni.xml", settings);

        writerXml.WriteStartElement("Animation");


        RecordXml = XmlWriter.Create("RealTimeAni.xml", settings);
        RecordXml.WriteStartElement("Animation");


        // get root objects in scene
        UnityEngine.SceneManagement.Scene scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
        List <GameObject> rootObjects           = new List <GameObject>(scene.rootCount + 1);

        scene.GetRootGameObjects(rootObjects);



        // iterate root objects and do something
        for (int i = 0; i < rootObjects.Count; i++)
        {
            Debug.Log("## Hello Object!");
            GameObject gameObj = rootObjects[i];
            if (gameObj != null)
            {
                ViewChild(gameObj.transform.gameObject, layer); // view all NodeTree of GameObject
                layer--;
                Debug.Log(gameObj.name);
            }
        }


        anim = GetComponent <Animator>();
        Debug.Log("$ anim name: " + anim.ToString());
        string             assetPath  = AssetDatabase.GetAssetPath(anim.runtimeAnimatorController);
        AnimatorController controller = AssetDatabase.LoadAssetAtPath <AnimatorController>(assetPath);

        Debug.Log("$ control name: " + controller.ToString());


        //////// loop by layer to get animation in each layer (object)
        for (int j = 0; j < controller.layers.Length; j++)
        {
            writerXml.WriteStartElement("AnimationLayer");
            writerXml.WriteAttributeString("name", (controller.layers[j].name).ToString());
            if (j == 0)
            {
                writerXml.WriteAttributeString("weight", "1");
            }
            if (j != 0)
            {
                writerXml.WriteAttributeString("weight", (controller.layers[j].defaultWeight).ToString());
            }
            writerXml.WriteAttributeString("iKPass", (controller.layers[j].iKPass).ToString());
            if (controller.layers[j].syncedLayerAffectsTiming == true)
            {
                writerXml.WriteAttributeString("SyncLayer", (controller.layers[j].syncedLayerIndex).ToString());
            }

            if (controller.layers[j].avatarMask)
            {
                Debug.Log("! ! ! ! Controller layer  " + j);
                Debug.Log("! Controller layer avatar  : " + controller.layers[j].avatarMask.name);
                Debug.Log("! Controller layer avatar transformCount : " + controller.layers[j].avatarMask.transformCount);
                writerXml.WriteStartElement("AvatarMask");
                for (int k = 0; k < controller.layers[j].avatarMask.transformCount; k++)
                {
                    if (controller.layers[j].avatarMask.GetTransformActive(k) == true)
                    {
                        //writerXml.WriteStartElement("AvatarMask");
                        //Debug.Log("! C : " + controller.layers[j].avatarMask.GetTransformActive(k).GetHashCode());
                        writerXml.WriteElementString(controller.layers[j].avatarMask.name, k.ToString());
                        //writerXml.WriteEndElement();
                    }
                }
                writerXml.WriteEndElement();
                //Debug.Log("! Controller layer avatar transform active : " + controller.layers[j].avatarMask.GetTransformActive(0));
            }
            AnimatorClipInfo[] m_AnimatorClipInfo = anim.GetCurrentAnimatorClipInfo(j); // (0):layer 0
            //anim.GetNextAnimatorClipInfo(j);
            Debug.Log("Starting clip[0] : " + m_AnimatorClipInfo[0].clip);
            Debug.Log("     clipInfo length : " + m_AnimatorClipInfo.Length);
            //Debug.Log("           duration : " + m_AnimatorClipInfo[0].clip.length);
            //Debug.Log("           event # : " + m_AnimatorClipInfo[0].clip.);
            Debug.Log("           speed : " + m_AnimatorClipInfo[0].clip.averageSpeed);
            for (int c = 0; c < m_AnimatorClipInfo.Length; c++) // run through each AniClip
            {
                writerXml.WriteStartElement("AnimationClip");
                writerXml.WriteAttributeString("name", (m_AnimatorClipInfo[c].clip).ToString());
                Debug.Log("Starting clip[c] : " + m_AnimatorClipInfo[c].clip);
                foreach (var binding in AnimationUtility.GetCurveBindings(m_AnimatorClipInfo[c].clip))
                {
                    //GameObject.Find((m_AnimatorClipInfo[c].clip).ToString());
                    writerXml.WriteStartElement(binding.propertyName);
                    for (int io = 0; io < rootObjects.Count; io++)
                    {
                        GameObject gameObj = rootObjects[io];
                        if (gameObj != null && AnimationUtility.GetAnimatedObject(gameObj, binding) != null)
                        {
                            writerXml.WriteElementString("Part", AnimationUtility.GetAnimatedObject(gameObj, binding).ToString());
                            //writerXml.WriteAttributeString("Part", AnimationUtility.GetAnimatedObject(gameObject, binding).ToString());
                            Debug.Log("@@@@@@ AnimatedObject : " + AnimationUtility.GetAnimatedObject(gameObj, binding));
                            GameObject Objj = GameObject.Find(AnimationUtility.GetAnimatedObject(gameObj, binding).ToString()
                                                              .Substring(0, (AnimationUtility.GetAnimatedObject(gameObj, binding).ToString()).Length - 24));
                            Debug.Log("@@@@@@ ObjectPosition : " + Objj.transform.position);                  // this is global position (position + parent+position)
                            //Debug.Log("@@@@@@ GlobalPosition : " + Objj.transform.TransformDirection(Objj.transform.position));
                            writerXml.WriteElementString("PartPosition", Objj.transform.position.ToString()); // this is global position (position + parent+position)
                            //writerXml.WriteElementString("PartLPosition", Objj.transform.TransformDirection(Objj.transform.position).ToString());
                        }
                    }


                    Debug.Log("@@@ curve binding : " + binding.propertyName);
                    AnimationCurve curve = AnimationUtility.GetEditorCurve(m_AnimatorClipInfo[c].clip, binding);
                    //Debug.Log("@@@ curve length : " + curve.length);
                    //Debug.Log("@@@ curve keys length : " + curve.keys.Length);
                    for (int ii = 0; ii < curve.keys.Length; ii++)
                    {
                        writerXml.WriteStartElement("Key");
                        writerXml.WriteAttributeString("time", (curve.keys[ii].time).ToString());
                        writerXml.WriteString((curve.keys[ii].value).ToString());
                        writerXml.WriteEndElement();
                        //writerXml.WriteElementString((curve.keys[ii].time).ToString(), (curve.keys[ii].value).ToString());
                        Debug.Log("@ curve keys[ii] time : " + curve.keys[ii].time + ", value: " + curve.keys[ii].value);
                        //Debug.Log("@ curve keys[i] value : " + curve.keys[i].value);
                    }
                    writerXml.WriteEndElement();
                    //Debug.Log("@@@ curve keys[0] time : " + curve.keys[0].time);
                }
                writerXml.WriteEndElement();
            }
            writerXml.WriteEndElement();
        }

        //UnityEditor.Animations.AnimatorController ac = Selection.activeObject as UnityEditor.Animations.AnimatorController;
        Debug.Log("Controller name : " + controller.name);
        Debug.Log("Controller layer# : " + controller.layers.Length);
        //Debug.Log("Controller layer avatar : " + controller.layers[0].avatarMask.name);
        //Debug.Log("Controller layer[1] name : " + controller.layers[1].name);
        Debug.Log("Controller layer[0] state machine : " + controller.layers[0].stateMachine.name);
        Debug.Log("Controller layer[0] timing : " + controller.layers[0].syncedLayerAffectsTiming);
        //Debug.Log("Controller layer iK : " + controller.layers[0].iKPass);
        //Debug.Log("Time : " + GetComponent<Animator>().runtimeAnimatorController.animationClips[0].length); // 1.8333 my duration of animation in animator

        //Debug.Log(anim.runtimeAnimatorController.animationClips);

        writerXml.WriteFullEndElement();
        writerXml.Close();
    }
Exemple #13
0
    // Use this for initialization
    void Start()
    {
        Health = MaxHealth;
        position = this.transform.position;
        ori = 0;

        dimension = GameObject.FindGameObjectWithTag("MapManager").GetComponent<MapManager>().dimension;
        taille = GameObject.FindGameObjectWithTag("MapManager").GetComponent<MapManager>().taille;

        anim = GetComponentsInChildren<Animator>();
        Debug.Log(anim.ToString());
        anim1 = anim[0];
        Debug.Log(anim1.ToString());
        anim2 = anim[1];
        Debug.Log(anim2.ToString());
    }
Exemple #14
0
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Log("OnStateExit Animator: " + animator.ToString() + ", si: " + stateInfo.ToString());

        animator.SetBool("_AnimFinished", true);
    }