Exemplo n.º 1
0
        bool CalculateVelocityLand(ref Vector3 velocity)
        {
            Vector3 v = new Vector3(velocity.x, 0.0f, velocity.z);

            if (v.sqrMagnitude > 0.01f * 0.01f)
            {
                Vector3 vv = v.normalized * Time.deltaTime * m_MotionMove.motor.maxForwardSpeed * 5.0f;

                Vector3 vff = m_Trans.forwardBottom;
                Vector3 vfc = m_Trans.forwardCenter;

                Vector3 nvff = vff + vv;
                Vector3 nvfc = vfc + vv;

                Vector3 vg;
                if (!PEUtil.CheckPositionOnGround(nvff, out vg, 5.0f, 5.0f, GameConfig.GroundLayer))
                {
                    return(false);
                }
                else
                {
                    if (PEUtil.CheckPositionUnderWater(nvfc))
                    {
                        if (!RandomDungenMgrData.InDungeon)
                        {
                            if (PEUtil.CheckPositionOnGround(nvfc + v.normalized * 32.0f, out vg, 128.0f, 128.0f, GameConfig.GroundLayer))
                            {
                                if (PEUtil.CheckPositionUnderWater(vg))
                                {
                                    return(false);
                                }
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }