Exemplo n.º 1
0
 public MeshNormals(IMesh mesh, NormalsTypes eType = NormalsTypes.Vertex_OneRingFaceAverage_AreaWeighted)
 {
     Mesh       = mesh;
     NormalType = eType;
     Normals    = new DVector <Vector3D>();
     VertexF    = Mesh.GetVertex;
 }
    IEnumerator WarningAttack_IrisSkill4()
    {
        Bullet bul;

        warningSquare = FavoriteFunction.WarningSquare(transform.position, 1f, 1f);
        warningSquare.transform.localScale = new Vector3(30f, 0.25f, 1f);

        DVector = FavoriteFunction.VectorCalc(gameObject, oNum);
        DVector.Normalize();

        rotatingAngle = DVector.y > 0 ? Vector3.Angle(DVector, Vector3.right) : -Vector3.Angle(DVector, Vector3.right);
        warningSquare.transform.Rotate(Vector3.forward, rotatingAngle);

        bul = PhotonNetwork.Instantiate("TargetStatic", PlayerManager.instance.GetPlayerByNum(oNum).transform.position, Quaternion.identity, 0).GetComponent <Bullet>();
        bul.Init(shooterNum);

        PhotonView view = bul.gameObject.GetComponent <PhotonView>();

        yield return(new WaitForSeconds(0.5f + (bulNum * 0.1f)));

        Destroy(warningSquare);

        if (PlayerManager.instance.GetPlayerByNum(shooterNum) == PlayerManager.instance.Local)
        {
            bul = PhotonNetwork.Instantiate
                      ("Iris_Skill4Line", transform.position, Quaternion.identity, 0).GetComponent <Bullet>();
            bul.Init(shooterNum, view.viewID);

            DestroyToServer();
        }
    }
Exemplo n.º 3
0
 public unsafe void GetFaceGroupsBuffer(int *pBuffer)
 {
     if (this.HasTriangleGroups)
     {
         DVector <int> .FastGetBuffer(this.FaceGroups, pBuffer);
     }
 }
Exemplo n.º 4
0
 public void CalcCorners(double x, double y)
 {
     var centerPoint = new DVector(x, y);
     var zoom = 16f;
     MercatorProjection();
     GetCorners(centerPoint, zoom, width, height);
 }
Exemplo n.º 5
0
    IEnumerator MoveCircle()
    {
        float rotatingAngle;
        float rotatingAngle_Temp = 0f;

        float timer = 0f;

        while (true)
        {
            if (warningSquare == null)
            {
                break;
            }

            if (timer > 0.3f)
            {
                Destroy(warningSquare);

                break;
            }

            DVector = commuObject.transform.position - transform.position;
            DVector.Normalize();

            rotatingAngle = DVector.y > 0 ? Vector3.Angle(DVector, Vector3.right) : -Vector3.Angle(DVector, Vector3.right);
            warningSquare.transform.Rotate(Vector3.forward, rotatingAngle - rotatingAngle_Temp);
            rotatingAngle_Temp = rotatingAngle;

            timer += Time.deltaTime;
            yield return(null);
        }
        DestroyToServer();
    }
Exemplo n.º 6
0
    IEnumerator MoveIrisSkillLine()
    {
        float rotatingAngle;
        float rotatingAngle_Temp = 0f;
        float timer = 0f;

        while (true)
        {
            if (timer > 1.5f)
            {
                DestroyToServer();
                break;
            }

            DVector = commuObject.transform.position - transform.position;
            DVector.Normalize();

            rotatingAngle = DVector.y > 0 ? Vector3.Angle(DVector, Vector3.right) : -Vector3.Angle(DVector, Vector3.right);
            transform.Rotate(Vector3.forward, rotatingAngle - rotatingAngle_Temp);
            rotatingAngle_Temp = rotatingAngle;

            timer += Time.deltaTime;
            yield return(null);
        }
    }
    IEnumerator MoveDianaSkillLine()    //질문을 해보도록 함. 과연 레이저 형식이 나은지 아니면 탄환이 나은지
    {
        float rotatingAngle;
        float rotatingAngle_Temp = 0f;
        float timer = 0f;

        while (true)
        {
            if (timer > 0.1f)
            {
                break;
            }

            DVector = commuObject.transform.position - transform.position;
            DVector.Normalize();

            rotatingAngle = DVector.y > 0 ? Vector3.Angle(DVector, Vector3.right) : -Vector3.Angle(DVector, Vector3.right);
            transform.Rotate(Vector3.forward, rotatingAngle - rotatingAngle_Temp);
            rotatingAngle_Temp = rotatingAngle;

            timer += Time.deltaTime;
            yield return(null);
        }
        DestroyToServer();
    }
Exemplo n.º 8
0
    public static void PruneCell(DVector cell)
    {
        GameState.Instance.FoodSources.Remove(cell);
        GameState.Instance.FoodSpenders.Remove(cell);

        GameState.Instance.ActualGrid.SetCell(
            cell,
            GameState.Instance.InitialGrid.GetCell(cell));

        foreach (var neighbor in cell.Get4Neighbours())
        {
            if (!TileTypesHelper.IsActive((TileType)GameState.Instance.ActualGrid.GetCell(neighbor)))
            {
                continue;
            }
            bool hasFilledNeigbor =
                neighbor.Get4Neighbours()
                .Select(GameState.Instance.ActualGrid.GetCell)
                .Cast <TileType>()
                .Any(TileTypesHelper.IsFilled);
            if (hasFilledNeigbor)
            {
                continue;
            }
            GameState.Instance.ActualGrid.SetCell(
                neighbor,
                (int)TileTypesHelper.ToInactive((TileType)GameState.Instance.ActualGrid.GetCell(neighbor)));
        }
    }
Exemplo n.º 9
0
        public static int[] GetTrisOnPositiveSide(DMesh3 mesh, Frame3f plane)
        {
            DVector <int> keep_tris = new DVector <int>();

            Vector3d[] tri = new Vector3d[3];
            foreach (int tid in mesh.TriangleIndices())
            {
                mesh.GetTriVertices(tid, ref tri[0], ref tri[1], ref tri[2]);
                bool ok = true;
                for (int j = 0; j < 3; ++j)
                {
                    double d = (tri[j] - plane.Origin).Dot(plane.Z);
                    if (d < 0)
                    {
                        ok = false;
                    }
                }
                if (ok)
                {
                    keep_tris.Add(tid);
                }
            }

            return(keep_tris.GetBuffer());
        }
Exemplo n.º 10
0
        public void FloodFill(int[] Seeds, Func <int, bool> FilterF = null)
        {
            DVector <int> stack = new DVector <int>(Seeds);

            while (stack.Size > 0)
            {
                int tID = stack.back;
                stack.pop_back();

                Index3i nbrs = Mesh.GetTriNeighbourTris(tID);
                for (int j = 0; j < 3; ++j)
                {
                    int nbr_tid = nbrs[j];
                    if (nbr_tid == NGonsCore.geometry3Sharp.mesh.DMesh3.InvalidID || IsSelected(nbr_tid))
                    {
                        continue;
                    }
                    if (FilterF != null && FilterF(nbr_tid) == false)
                    {
                        continue;
                    }
                    Add(nbr_tid);

                    stack.push_back(nbr_tid);
                }
            }
        }
Exemplo n.º 11
0
            public void Build(ToolpathSet toolpaths, Interval1d zrange, double cellSize = 2.0)
            {
                segments = new DVector <Segment2d>();
                grid     = new SegmentHashGrid2d <int>(cellSize, -1);

                Action <LinearToolpath3 <PrintVertex> > processPathF = (polyPath) => {
                    if (polyPath.Type != ToolpathTypes.Deposition || polyPath.IsPlanar == false)
                    {
                        return;
                    }
                    if ((polyPath.TypeModifiers & FillTypeFlags.OutermostShell) == 0)
                    {
                        return;
                    }
                    Vector3d v0 = polyPath.Start.Position;
                    Vector3d v1 = polyPath.End.Position;
                    if (zrange.Contains(v0.z) == false || zrange.Contains(v1.z) == false)
                    {
                        return;
                    }
                    append_path(polyPath, cellSize);
                };

                process_linear_paths(toolpaths, processPathF);
            }
Exemplo n.º 12
0
 public unsafe void GetVertexColorBuffer(float *pBuffer)
 {
     if (this.HasVertexColors)
     {
         DVector <float> .FastGetBuffer(this.Colors, pBuffer);
     }
 }
Exemplo n.º 13
0
 public unsafe void GetVertexUVBuffer(float *pBuffer)
 {
     if (this.HasVertexUVs)
     {
         DVector <float> .FastGetBuffer(this.UVs, pBuffer);
     }
 }
Exemplo n.º 14
0
 public DVector(DVector other) : this(yarpPINVOKE.new_DVector__SWIG_1(DVector.getCPtr(other)), true)
 {
     if (yarpPINVOKE.SWIGPendingException.Pending)
     {
         throw yarpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 15
0
 public unsafe void GetVertexNormalBuffer(float *pBuffer)
 {
     if (this.HasVertexNormals)
     {
         DVector <float> .FastGetBuffer(this.Normals, pBuffer);
     }
 }
Exemplo n.º 16
0
 public DVectorEnumerator(DVector collection)
 {
     collectionRef = collection;
     currentIndex  = -1;
     currentObject = null;
     currentSize   = collectionRef.Count;
 }
Exemplo n.º 17
0
        protected override void ApplyCurrentStamp(Frame3f vCenter, int tid, DijkstraGraphDistance dj,
                                                  DVector <Vector3d> Displacements, HashSet <int> ModifiedV)
        {
            List <int> order = dj.GetOrder();
            int        N     = order.Count;

            for (int k = 0; k < N; ++k)
            {
                int      vid = order[k];
                Vector3d v   = Mesh.GetVertex(vid);

                double d = v.Distance(vCenter.Origin);
                double t = MathUtil.Clamp(d / Radius, 0.0, 1.0);
                t = MathUtil.WyvillFalloff01(t);

                Vector3d c = Vector3d.Zero;
                Mesh.VtxOneRingCentroid(vid, ref c);

                t *= Power;
                Vector3d s = Vector3d.Lerp(ref v, ref c, t);

                Displacements[vid] = s;
                ModifiedV.Add(vid);
            }
        }
Exemplo n.º 18
0
        public TemporalPathHash()
        {
            Segments = new DVector <Segment2d>();
            Times    = new DVector <int>();

            Hash = new SegmentHashGrid2d <int>(HashBucketSize, -1);
        }
Exemplo n.º 19
0
    public bool IsConnectedWithout(DVector position)
    {
        if (!states.ContainsKey(position))
        {
            return(true);
        }

        HashSet <DVector> visitedCells = new HashSet <DVector>()
        {
            position
        };
        Queue <DVector> toVisit = new Queue <DVector>();

        toVisit.Enqueue(new DVector(0, 0));
        while (toVisit.Count > 0)
        {
            var next = toVisit.Dequeue();
            visitedCells.Add(next);
            foreach (var neighbor in next.Get4Neighbours())
            {
                if (!states.ContainsKey(neighbor) ||
                    visitedCells.Contains(neighbor) ||
                    !TileTypesHelper.IsFilled((TileType)states[neighbor]))
                {
                    continue;
                }
                toVisit.Enqueue(neighbor);
            }
        }

        return(visitedCells.SetEquals(GetFilledCells()));
    }
Exemplo n.º 20
0
 public void AddRange(DVector values)
 {
     yarpPINVOKE.DVector_AddRange(swigCPtr, DVector.getCPtr(values));
     if (yarpPINVOKE.SWIGPendingException.Pending)
     {
         throw yarpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 21
0
 public void InitFromTileMap(TileMap map)
 {
     foreach (Vector2 e in map.GetUsedCells())
     {
         var dv = DVector.FromVector2(e);
         SetCell(dv, map.GetCell(dv.X, dv.Y));
     }
 }
Exemplo n.º 22
0
 public int GetCell(DVector pos)
 {
     if (!states.ContainsKey(pos))
     {
         return(-1);
     }
     return(states[pos]);
 }
Exemplo n.º 23
0
 public void SetRange(int index, DVector values)
 {
     yarpPINVOKE.DVector_SetRange(swigCPtr, index, DVector.getCPtr(values));
     if (yarpPINVOKE.SWIGPendingException.Pending)
     {
         throw yarpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 24
0
 public void Initialize(bool bWantNormals = true, bool bWantColors = true, bool bWantUVs = true, bool bWantFaceGroups = true)
 {
     Vertices   = new DVector <double>();
     Normals    = (bWantNormals) ? new DVector <float>() : null;
     Colors     = (bWantColors) ? new DVector <float>() : null;
     UVs        = (bWantUVs) ? new DVector <float>() : null;
     Triangles  = new DVector <int>();
     FaceGroups = (bWantFaceGroups) ? new DVector <int>() : null;
 }
Exemplo n.º 25
0
        public static void Restore(DVector <short> vec, BinaryReader reader)
        {
            int N = reader.ReadInt32();

            byte[]  bytes  = reader.ReadBytes(N * sizeof(short));
            short[] buffer = new short[N];
            Buffer.BlockCopy(bytes, 0, buffer, 0, bytes.Length);
            vec.Initialize(buffer);
        }
Exemplo n.º 26
0
    public bool getLimits(int axis, DVector min, DVector max)
    {
        bool ret = yarpPINVOKE.IControlLimits_getLimits__SWIG_1(swigCPtr, axis, DVector.getCPtr(min), DVector.getCPtr(max));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemplo n.º 27
0
    protected override void Move(int _shooterNum)
    {
        StartCoroutine(DestroyIrisSkill4());

        DVector = commuObject.transform.position - transform.position;
        DVector.Normalize();

        rotatingAngle = DVector.y > 0 ? Vector3.Angle(DVector, Vector3.right) : -Vector3.Angle(DVector, Vector3.right);
        transform.Rotate(Vector3.forward, rotatingAngle);
    }
Exemplo n.º 28
0
    public bool relativeMove(DVector data)
    {
        bool ret = yarpPINVOKE.IPositionControl_relativeMove__SWIG_3(swigCPtr, DVector.getCPtr(data));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemplo n.º 29
0
    public bool getRefSpeed(int j, DVector data)
    {
        bool ret = yarpPINVOKE.IPositionControl_getRefSpeed__SWIG_1(swigCPtr, j, DVector.getCPtr(data));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemplo n.º 30
0
    public bool getRefAccelerations(DVector data)
    {
        bool ret = yarpPINVOKE.IPositionControl_getRefAccelerations__SWIG_2(swigCPtr, DVector.getCPtr(data));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
 public bool getRefAccelerations(DVector data)
 {
     bool ret = yarpPINVOKE.IVelocityControl_getRefAccelerations__SWIG_1(swigCPtr, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public bool velocityMove(DVector data)
 {
     bool ret = yarpPINVOKE.IVelocityControl_velocityMove__SWIG_2(swigCPtr, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public bool setRefSpeeds(DVector data)
 {
     bool ret = yarpPINVOKE.IPositionControl_setRefSpeeds__SWIG_1(swigCPtr, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public bool relativeMove(DVector data)
 {
     bool ret = yarpPINVOKE.IPositionControl_relativeMove__SWIG_2(swigCPtr, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public bool getRefAcceleration(int j, DVector data)
 {
     bool ret = yarpPINVOKE.IPositionControl_getRefAcceleration__SWIG_1(swigCPtr, j, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 36
0
 public bool getEncoderAccelerations(DVector data)
 {
     bool ret = yarpPINVOKE.IEncoders_getEncoderAccelerations__SWIG_1(swigCPtr, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 37
0
 public bool getErrorLimit(int j, DVector data)
 {
     bool ret = yarpPINVOKE.IPidControl_getErrorLimit__SWIG_1(swigCPtr, j, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 38
0
 public bool getReferences(DVector data)
 {
     bool ret = yarpPINVOKE.IPidControl_getReferences__SWIG_1(swigCPtr, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public bool getCurrents(DVector data)
 {
     bool ret = yarpPINVOKE.IAmplifierControl_getCurrents__SWIG_1(swigCPtr, DVector.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public bool getLimits(int axis, DVector min, DVector max)
 {
     bool ret = yarpPINVOKE.IControlLimits_getLimits__SWIG_1(swigCPtr, axis, DVector.getCPtr(min), DVector.getCPtr(max));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }