예제 #1
0
    public void GenerateStateChangeEvents(ref CharacterInterpolatedData animState)
    {
        if (animState.charLocoState != previousLocoState)

        {
            if (animState.charLocoState == CharacterPredictedData.LocoState.DoubleJump)
            {
                onDoubleJump = true;
            }

            if (animState.charLocoState == CharacterPredictedData.LocoState.Stand ||
                animState.charLocoState == CharacterPredictedData.LocoState.GroundMove)
            {
                if (previousLocoState == CharacterPredictedData.LocoState.InAir ||
                    previousLocoState == CharacterPredictedData.LocoState.DoubleJump)
                {
                    onLand = true;
                }
            }

            if (animState.charLocoState == CharacterPredictedData.LocoState.Jump)
            {
                onJumpStart = true;
            }

            previousLocoState = animState.charLocoState;
        }
    }
예제 #2
0
        void DebugSceneView(CharacterInterpolatedData animState)
        {
            if (m_template.footIK.debugIdlePos)
            {
                var rotation     = Quaternion.Euler(0f, animState.rotation, 0f);
                var leftIdlePos  = rotation * m_template.footIK.leftToeStandPos + animState.position;
                var rightIdlePos = rotation * m_template.footIK.rightToeStandPos + animState.position;

                DebugDraw.Sphere(leftIdlePos, 0.01f, Color.green);
                DebugDraw.Sphere(leftIdlePos, 0.04f, Color.green);
                DebugDraw.Sphere(rightIdlePos, 0.01f, Color.red);
                DebugDraw.Sphere(rightIdlePos, 0.04f, Color.red);
            }

            if (m_template.footIK.debugRayCast)
            {
                DebugDraw.Sphere(m_LeftFootPos, 0.025f, Color.yellow);
                DebugDraw.Sphere(m_RightFootPos, 0.025f, Color.yellow);

                DebugDraw.Sphere(m_LeftHit.point, 0.015f);
                DebugDraw.Sphere(m_RightHit.point, 0.015f);

                Debug.DrawLine(m_LeftHit.point, m_LeftHit.point + m_LeftHit.normal, Color.green);
                Debug.DrawLine(m_RightHit.point, m_RightHit.point + m_RightHit.normal, Color.red);
            }
        }
예제 #3
0
    public void Update(Vector3 target, Settings settings, CharacterInterpolatedData animationState, AnimationScriptPlayable playable)
    {
        var job = playable.GetJobData <AimDragJob>();

        job.settings  = settings;
        job.animState = animationState;
        playable.SetJobData(job);
    }
예제 #4
0
    public void Update(CharacterInterpolatedData animState, Settings settings, AnimationScriptPlayable playable)
    {
        var job = playable.GetJobData <BankingJob>();

        job.animState  = animState;
        job.bankAmount = animState.banking;
        job.settings   = settings;
        playable.SetJobData(job);
    }
예제 #5
0
        void DebugUpdatePresentation(CharacterInterpolatedData animState)
        {
            if (debugStandIk.IntValue > 0)
            {
                var charIndex = s_Instances.IndexOf(this);
                var lineIndex = charIndex * 3 + 3;

                var debugString = "Char " + charIndex + " - IK Offset: " + animState.footIkOffset.x.ToString("0.000") +
                                  ", " + animState.footIkOffset.y.ToString("0.000");
                GameDebug.Log(debugString);
            }
        }
예제 #6
0
    public void Update(ref CharacterInterpolatedData animState)
    {
        // Set supported animation state bools
        for (var i = 0; i < m_supportedAnimStates.Length; i++)
        {
            m_animatorController.SetBool(m_supportedAnimStates[i].hash, animState.charLocoState == m_supportedAnimStates[i].state);
        }

        // Set supported action state bools
        for (var i = 0; i < m_supportedActionStates.Length; i++)
        {
            m_animatorController.SetBool(m_supportedActionStates[i].hash, animState.charAction == m_supportedActionStates[i].action);
        }

        // Set supported triggers
        if (animState.charAction != m_lastActionTriggered || animState.charActionTick != lastActionTick)
        {
            // Clear last trigger
            if (m_lastActionTriggered != CharacterPredictedData.Action.None)
            {
                m_animatorController.ResetTrigger(m_supportedActionTriggers[(int)m_lastActionTriggered]);
            }

            m_lastActionTriggered = CharacterPredictedData.Action.None;

            // Trigger new action trigger if it is supported
            if (m_supportedActionTriggers[(int)animState.charAction] != 0)
            {
                m_lastActionTriggered = animState.charAction;
                m_animatorController.SetTrigger(m_supportedActionTriggers[(int)m_lastActionTriggered]);
            }
        }
        lastActionTick = animState.charActionTick;

        m_animatorController.SetBool(m_sprintState, animState.sprinting == 1);

        if (animState.damageTick > m_lastReactionTick + m_waitFor)
        {
            m_animatorController.SetTrigger(m_hitReaction);
            m_lastReactionTick = animState.damageTick;

            Random.InitState(animState.damageTick);
            m_waitFor = Random.Range(4, 6);
        }
    }
    public static void Update(ItemActionTimelineTrigger behavior, CharacterInterpolatedData animState)
    {
        var newAction     = behavior.m_prevAction != animState.charAction;
        var newActionTick = behavior.m_prevActionTick != animState.charActionTick;

        if (newAction || newActionTick)
        {
            PlayableDirector director;
            if (behavior.m_actionTimelines.TryGetValue(animState.charAction, out director))
            {
                if (behavior.m_currentActionTimeline != null && director != behavior.m_currentActionTimeline)
                {
                    behavior.m_currentActionTimeline.Stop();
                }

                behavior.m_currentActionTimeline      = director;
                behavior.m_currentActionTimeline.time = 0;

                behavior.m_currentActionTimeline.Play();
            }
        }
        behavior.m_prevAction     = animState.charAction;
        behavior.m_prevActionTick = animState.charActionTick;
    }
예제 #8
0
 bool TimeToSquash(CharacterInterpolatedData animState)
 {
     return(Math.Abs(animState.squashTime) < 0.001f || animState.squashTime >= m_animSquash.GetDuration());
 }