Exemple #1
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");
 }
 void PrintAnimatorStateInfo(int layer, AnimatorStateInfo animatorStateInfo)
 {
     Debug.Log("Layer: " + layer);
     Debug.Log("FullPathHash: " + animatorStateInfo.fullPathHash);
     Debug.Log("NormalizedTime: " + animatorStateInfo.normalizedTime);
     Debug.Log("Length: " + animatorStateInfo.length);
     Debug.Log("String: " + animatorStateInfo.ToString());
 }
    // 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
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Log("End Anim" + stateInfo.ToString());
        Player p = GameObject.Find("Player").GetComponent <Player>();

        p.GetComponentInChildren <Animator>().SetBool("Attack", false);
        p.m_AttackCount = 0;
        p.m_Attacking   = false;
        p.ResetComboValidated();
    }
Exemple #4
0
    /// <summary>
    /// ダウンアニメーションが終わっているかどうか
    /// </summary>
    /// <returns>終了しているかどうか</returns>
    public bool IsDownAnimEnd()
    {
        if (isDown && anim != null)
        {
            AnimatorStateInfo currentState = anim.GetCurrentAnimatorStateInfo(0);
            Debug.Log("現在の状態: " + currentState.ToString());

            if (currentState.IsName("player_knockdown"))    //文字列として出すために⇒.IsName()
            {
                if (currentState.normalizedTime >= 1)
                {
                    return(true);
                }
            }
        }

        return(false);
    }
    // OnStateExit is called before OnStateExit is called on any state inside this state machine
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Log("stateInfo : " + stateInfo.IsName("behit") + " " + stateInfo.ToString());
        var  goe           = animator.transform.parent.GetComponent <GameObjectEntity>();
        bool hasLocomotion = SceneMgr.Instance.EntityManager.HasComponent <LocomotionState>(goe.Entity);

        Debug.Log("animator beh haslocomo" + hasLocomotion);
        if (hasLocomotion)
        {
            var locoState = SceneMgr.Instance.EntityManager.GetComponentData <LocomotionState>(goe.Entity);
            Debug.Log("loco state:" + locoState.LocoState);
            // if (locoState.LocoState == LocomotionState.State.BeHit)
            {
                locoState.LocoState = LocomotionState.State.Idle;
                locoState.StartTime = Time.time;
                SceneMgr.Instance.EntityManager.SetComponentData <LocomotionState>(goe.Entity, locoState);
            }
        }
    }
Exemple #6
0
    // Use this for initialization
    void Start()
    {
        moveDir = 1;
        AnimatorStateInfo state = Mario.marioAnim.GetCurrentAnimatorStateInfo(0);
        string            name  = state.ToString();

        if (state.IsTag("right"))
        {
            moveDir = 1;
        }
        else
        {
            moveDir = -1;
        }
        upDown    = -1;
        vertSpeed = 6;
        moveSpd   = 10;
        vertCeil  = 100;
        Mario.numFire++;
    }
Exemple #7
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) {
    //
    //}

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Log(stateInfo.ToString());
    }
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Log("OnStateExit Animator: " + animator.ToString() + ", si: " + stateInfo.ToString());

        animator.SetBool("_AnimFinished", true);
    }
Exemple #9
0
        public void StunUpdate(ref AbsorbMechanic absMec)
        {
            //Debug.Log("updating stun");
            stateInfo = animator.GetCurrentAnimatorStateInfo(0);

            //Debug.Log("Normalized state time: " + stateInfo.normalizedTime);
            if (stageOneEntered)
            {
                if (!clipSet)
                {
                    Debug.Log("Setting the clip: " + grabanimationHash);

                    //AnimatorClipInfo[] clips = animator.GetNextAnimatorClipInfo(0);
                    stateInfo = animator.GetCurrentAnimatorStateInfo(0);
                    if (stateInfo.IsName("Grab"))
                    {
                        clipSet = true;
                        time    = stateInfo.length;
                        Debug.Log("Time is: " + time);
                    }
                    else
                    {
                        Debug.Log("Animation playing: " + stateInfo.ToString());
                        return;
                    }
                }

                //Debug.Log("Normalized state time: " + stateInfo.normalizedTime);
                elapsedTime += GameManager.Instance.DeltaTime;

                //Set the target character's parent as the current character's hand
                if (!parentSet)
                {
                    //After ta certain amount of time, set the enemy as child to the player's hand
                    if (elapsedTime > time * 0.4f)
                    {
                        //Halt character movement of both the player and the enemy
                        c.GetComponent <Enemy>().GettingAbsorbed(player, time);

                        c.GetComponent <Collider2D>().enabled = false;
                        Debug.Log("Parent set");
                        c.transform.parent        = player.Hand.transform;
                        c.transform.localPosition = new Vector3(0, -1.0f, 0);
                        c.transform.localRotation = Quaternion.Euler(0, 0, 0);
                        //c.playerSprite.GetComponent<SpriteRenderer>().sortingOrder = player.playerSprite.GetComponent<SpriteRenderer>().sortingOrder - 1;

                        parentSet = true;
                    }
                    return;
                }

                if (elapsedTime > time)
                {
                    animator.SetBool("Absorb", false);

                    if (!stateInfo.IsName("Grab") && !animator.IsInTransition(0))
                    {
                        //TODO: Start a different animation here
                        //For now, just disable the character
                        stageOneEntered = false;
                        stageTwoEntered = true;
                    }
                }

                c.transform.localPosition = new Vector3(0, -1.0f, 0);
                c.transform.localRotation = Quaternion.Euler(0, 0, 0);
            }

            if (stageTwoEntered)
            {
                //Here, the PH transformation must start and respective animation must play
                //Keep the player's movements blocked till then
                StartReaction(c);

                //Deactivate the enemy for now
                c.GetComponent <Enemy>().Die();

                absMec = null;
            }
        }