示例#1
0
    public void surface_calculator()
    {
        theoretical_radius = theoretical_radius + Proportional_increment;
        //Debug.Log("radius" + radius);
        //Debug.Log("theorie radius" + theoretical_radius);
        Track_Surface_old = Track_Surface;
        Track_Surface     = 0;
        for (int i = 0; i < triangles.Length; i = i + 3)
        {
            Vector3 A = vertices[triangles[i]];
            Vector3 B = vertices[triangles[i + 1]];
            Vector3 C = vertices[triangles[i + 2]];
            //Debug.Log(B);
            Track_Surface += Mathf.Abs((A.x * (B.z - C.z) + B.x * (C.z - A.z) + C.x * (A.z - B.z)) / 2);
        }
        //Debug.Log(Track_Surface);
        Track_null_Surface = 0;//2 * radius * (float)3.14;
        for (int i = 0; i < triangles.Length; i = i + 3)
        {
            Vector3 AA = new Vector3();
            AA.x = 0; AA.y = 0.2f; AA.z = 0;
            Vector3 BB = new Vector3();
            BB.x = theoretical_radius * Mathf.Sin(0);; BB.y = 0f; BB.z = theoretical_radius * Mathf.Cos(0);
            Vector3 CC = new Vector3();
            CC.x = theoretical_radius * Mathf.Sin(deltaAngle * val); CC.y = 0f; CC.z = theoretical_radius * Mathf.Cos(deltaAngle * val);
            Track_null_Surface += Mathf.Abs((AA.x * (BB.z - CC.z) + BB.x * (CC.z - AA.z) + CC.x * (AA.z - BB.z)) / 2);
        }

        if (PhotonNetwork.IsMasterClient)
        {
            //pass through what they managed to stop
            TUTPART1LavaSpawner.Update_Score(Track_null_Surface - Track_Surface, hole);
        }
    }
示例#2
0
    private void Start()
    {
        if (PhotonNetwork.IsMasterClient)
        {
            hole           = TUTPART1LavaSpawner.Register_Hole(gameObject);
            GlobalPosition = TUTPART1LavaSpawner.Get_Position(hole);
        }

        mesh = new Mesh();
        Createmesh();

        InvokeRepeating("MeshGrowing", 1f, 0.2f);
        InvokeRepeating("surface_calculator", 1f, 0.2f);
    }
示例#3
0
    //public void UpdateMesh(float Track_Surface_old, float Track_Surface)
    public void UpdateMesh(bool create)
    {
        this_object = gameObject;
        //if (isServer)
        //MeshChange(vertices, triangles);

        if (PhotonNetwork.IsMasterClient)
        {
            //pass through what they managed to stop
            TUTPART1LavaSpawner.Update_Score(Track_null_Surface - Track_Surface, hole);
            PhotonView photonView = PhotonView.Get(this);
            photonView.RPC("MeshChange", RpcTarget.All, vertices, triangles, create, startradius);
        }
    }