Ejemplo n.º 1
0
    public void UpdateDashState(State currState, float deltaTime)
    {
        m_CurrDashTime -= deltaTime;
        if (m_CurrDashTime <= 0.0f)
        {
            m_PlayerStateMachine.CanChangeState = true;
        }

        m_Animation.CrossFade("Run");

        if (Vector3.SqrMagnitude(m_LastDashDecalPointAdded - transform.position) >= (m_DecalPointAddDist * m_DecalPointAddDist))
        {
            RaycastHit rayHit;
            if (PhysicsUtils.RaycastToGround(transform.position, out rayHit))
            {
                m_LastDashDecalPointAdded = rayHit.point;
            }
            else
            {
                m_LastDashDecalPointAdded = transform.position;
            }

            m_CurrentDecal.AddPoint(m_LastDashDecalPointAdded + Vector3.up * m_DecalUpOffset);
        }
        m_CurrRunTime = m_RunTimeToDash;
    }
Ejemplo n.º 2
0
    // End Walk, Run State
    // -----------------

    // -----------------
    // Start Dash State
    public void BeginDashState(State prvState, State newState)
    {
        //m_Animation.Play();
        //SetCharacterFlag(CharacterFlag.eCF_ResetMoveSpeedAfterUse);
        CurrentVelocity    = new Vector3(0.0f, m_OnGroundYVelocity, 0.0f);
        m_CurrentDashSpeed = m_DefaultMoveSpeed * m_DashSpeedMultiplier;// Can be current speed.
        CurrentMoveSpeed   = m_CurrentDashSpeed;
        m_PlayerStateMachine.CanChangeState = false;
        m_CurrRunTime = m_RunTimeToDash;

        m_CurrentDecal = m_DecalsManaer.CreateDecal(DecalsManager.DecalsType.DT_Tape);

        RaycastHit rayHit;

        if (PhysicsUtils.RaycastToGround(transform.position, out rayHit))
        {
            m_LastDashDecalPointAdded = rayHit.point;
        }
        else
        {
            m_LastDashDecalPointAdded = transform.position;
        }

        m_CurrentDecal.Thickness = m_DecalThickness;
        m_CurrentDecal.AddPoint(m_LastDashDecalPointAdded + Vector3.up * m_DecalUpOffset);
        m_CurrentDecal.UpVector = transform.up;

        m_CurrDashTime = m_MaxDashTime;
        m_Animation.CrossFade("Run");

        m_PlayerHUD.ShowMeter();
    }
Ejemplo n.º 3
0
    // Update is called once per frame
    protected override void Update()
    {
        if (m_Launch && !m_Launched)
        {
            m_Launched = true;
            Launch();
        }
        if (m_ToBeDestroyed)
        {
            m_ToBeDestroyed = false;
            Manager.DestroyProjectile(this);
        }
        if (!m_AddingDecals && m_ShowGroundDecalAndDestroy)
        {
            m_AddingDecals           = true;
            m_CurrentDecal           = m_DecalsManager.CreateDecal(DecalsManager.DecalsType.DT_Crack);
            m_CurrentDecal.Thickness = m_DecalWidth;


            RaycastHit rayHit;
            if (PhysicsUtils.RaycastToGround(transform.position, out rayHit))
            {
                m_LastDecalPos = rayHit.point;
            }
            else
            {
                m_LastDecalPos = transform.position;
            }

            m_CurrentDecal.AddPoint(m_LastDecalPos + Vector3.up * m_DecalUpOffset);

            Vector3 velocity = Velocity;
            velocity.y          = 0.0f;
            m_CurrDecalAddSpeed = velocity.magnitude;
            m_DecalAddDir       = velocity.normalized;
            m_CurrDecalAddDist  = 0.0f;

            m_MeshRenderer.enabled = false;

            //
            SetToDestroy();
            m_CurrentDecal.AddPoint(m_LastDecalPos + Vector3.up * m_DecalUpOffset + m_DecalAddDir * m_DecalWidth);
        }

        /*if (m_AddingDecals)
         * {
         *  m_CurrDecalAddSpeed -= m_DecalAddDeAcceleration * Time.deltaTime;
         *  m_CurrDecalAddDist += m_CurrDecalAddSpeed * Time.deltaTime;
         *
         *  if (m_CurrDecalAddDist >= m_DecalPointAddDist || m_CurrDecalAddSpeed <= 0.0f)
         *  {
         *      m_LastDecalPos += m_DecalAddDir * m_CurrDecalAddDist;
         *      m_CurrentDecal.AddPoint(m_LastDecalPos + Vector3.up * m_DecalUpOffset);
         *      m_CurrDecalAddDist = 0.0f;
         *  }
         *
         *  if (m_CurrDecalAddSpeed <= 0)
         *  {
         *      SetToDestroy();
         *      m_AddingDecals = false;
         *  }
         * }*/
    }