Exemplo n.º 1
0
                private Vector3 GetDismountPosition()
                {
                    Vector3 dismountPosition = controller.car.transform.position +
                                               (controller.car.transform.right * dismountLocal.x) +
                                               (controller.car.transform.up * 1.0f) + (controller.car.transform.forward * dismountLocal.z);

                    if (TerrainMeta.HeightMap.GetHeight(dismountPosition) > dismountPosition.y)
                    {
                        dismountPosition.y = TerrainMeta.HeightMap.GetHeight(dismountPosition) + 0.5f;
                    }

                    if (!Physics.CheckCapsule(dismountPosition + new Vector3(0f, 0.41f, 0f), dismountPosition + new Vector3(0f, 1.39f, 0f), 0.4f, LayerMask.GetMask("Construction")))
                    {
                        Vector3 vector3 = dismountPosition + new Vector3(0f, player.GetHeight() * 0.5f, 0f);
                        if (entity.IsVisible(vector3) && !Physics.Linecast(entity.transform.position + new Vector3(0f, 1f, 0f), vector3, 1075904513))
                        {
                            return(dismountPosition);
                        }
                    }

                    return(entity.transform.position + new Vector3(0f, 1.5f, 0f));
                }