Пример #1
0
    public static Sound PlaySoundOneTime(string soundToPlayRoot, Vector3 iniPos = new Vector3(), Transform container = null)
    {
        return(null);

        CamControl mainCam = USearch.FindCurrentCamera();
        Sound      temp    = null;

        if (Settings.ISSoundOn)
        {
            if (iniPos == Vector3.zero)
            {
                iniPos = mainCam.transform.GetComponent <Camera>().transform.position;
            }
            temp = (Sound)General.Create(soundToPlayRoot, iniPos);
        }

        if (container == null)
        {
            temp.transform.SetParent(mainCam.transform.GetComponent <Camera>().transform);
        }
        else
        {
            temp.transform.SetParent(container);
        }

        return(temp);
    }
Пример #2
0
    // Use this for initialization
    private void Start()
    {
        iniTransf = transform;
        mainCam   = USearch.FindCurrentCamera();

        if (isToKeepDistanceFromCamAndRotateLikeChild)
        {
            difference = mainCam.transform.position - transform.position;
        }
    }
Пример #3
0
Файл: UPoly.cs Проект: Cdrix/SM
    /// <summary>
    /// Will ray cast to all obj from active camera will ret the raycast
    /// </summary>
    /// <param name="screenPoint"></param>
    /// <returns></returns>
    public static RaycastHit RayCastAll(Vector2 screenPoint)
    {
        CamControl mainCam  = USearch.FindCurrentCamera();
        RaycastHit HitMouse = new RaycastHit();

        if (Physics.Raycast(mainCam.transform.GetComponent <Camera>().ScreenPointToRay(screenPoint), out HitMouse,
                            Mathf.Infinity))
        {
        }
        else
        {
            //Debug.Log("Mouse Did not Hit any obj UPoly.cs");
        }
        return(HitMouse);
    }
Пример #4
0
 // Update is called once per frame
 new internal void Update()
 {
     if (isToFollowCamera)
     {
         if (Camera.main != null)
         {
             transform.position = Camera.main.transform.position;
         }
         else
         {
             mainCamera         = USearch.FindCurrentCamera();
             transform.position = mainCamera.transform.position;
         }
     }
 }
Пример #5
0
Файл: UPoly.cs Проект: Cdrix/SM
    /// <summary>
    /// Will ray cast to layer , from active camera will ret the raycast
    /// </summary>
    /// <param name="screenPoint"></param>
    /// <returns></returns>
    public static RaycastHit RayCastLayer(Vector2 screenPoint, int layerNumb)
    {
        CamControl mainCam  = USearch.FindCurrentCamera();
        RaycastHit HitMouse = new RaycastHit();

        int layerMask = 1 << layerNumb;

        if (Physics.Raycast(mainCam.transform.GetComponent <Camera>().ScreenPointToRay(screenPoint), out HitMouse,
                            Mathf.Infinity, layerMask))
        {
        }
        else
        {
            //Debug.Log("Mouse Did not Hit Layer:"+layerNumb);
        }
        return(HitMouse);
    }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        camera = USearch.FindCurrentCamera();

        Malla     = (Malla)General.Create(Root.malla, container: Program.ClassContainer.transform);
        Poly      = new UPoly();
        subDivide = new SubDivider();
        Vertex    = new Vertexer();
        iniTerr   = new InitializerTerrain();

        iniTerr.Initializer(ref Vertices, ref mesh);
        iniTerr.InitializeMallaStats(Vertices, ref wholeMalla, ref nextStart, ref zLot);

        SubPolyr  = new SubPolyr();
        subMesh   = new SubMeshData();
        IsLoading = true;

        //bz is static and if a new game is started needs to clean up and start again
        CrystalManager1 = new CrystalManager();
    }
Пример #7
0
Файл: UPoly.cs Проект: Cdrix/SM
    /// <summary>
    /// Will ray cast to terrain (layer mask 8) from active camera will ret the raycast
    /// </summary>
    /// <param name="screenPoint"></param>
    /// <returns></returns>
    public static RaycastHit RayCastTerrain(Vector2 screenPoint)
    {
        CamControl mainCam = USearch.FindCurrentCamera();

        RaycastHit HitMouseOnTerrain = new RaycastHit();

        // Bit shift the index of the layer (8) to get a bit mask
        // This would cast rays only against colliders in layer 8.
        int layerMask = 1 << 8;

        // Does the ray intersect any objects in the layer 8 "Terrain Layer"
        if (Physics.Raycast(mainCam.transform.GetComponent <Camera>().ScreenPointToRay(screenPoint), out HitMouseOnTerrain,
                            Mathf.Infinity, layerMask))
        {
        }
        else
        {
            //Debug.Log("Mouse Did not Hit Layer 8: Terrain. UPoly.cs");
        }
        return(HitMouseOnTerrain);
    }