コード例 #1
0
 public static void AddHelper(GizmoHelper helper)
 {
     if (!helpers.Contains(helper))
     {
         helpers.Add(helper);
     }
 }
コード例 #2
0
ファイル: Spike.cs プロジェクト: oDingbat/2DOnlinePlatformer
    private void Start()
    {
        collider    = GetComponent <BoxCollider2D>();
        gizmoHelper = GameObject.Find("[GizmoHelper]").GetComponent <GizmoHelper>();

        if (transform.localEulerAngles.z == 0 || transform.localEulerAngles.z == 180)
        {
            constraints = RigidbodyConstraints2D.FreezePositionX;
        }
        else
        {
            constraints = RigidbodyConstraints2D.FreezePositionY;
        }

        switch (Mathf.Round(transform.localEulerAngles.z).ToString())
        {
        case ("0"):
            direction = new Vector2(0, 1);
            break;

        case ("90"):
            direction = new Vector2(-1, 0);
            break;

        case ("180"):
            direction = new Vector2(0, -1);
            break;

        case ("270"):
            direction = new Vector2(1, 0);
            break;
        }
    }
コード例 #3
0
    void OnDrawGizmosSelected()
    {
        var offset = 0.1f;

        GizmoHelper.DrawGizmoCircle(OuterVisibilityRadius, transform.position, true, 256);
        GizmoHelper.DrawGizmoCircle(OuterVisibilityRadius + offset, transform.position, true, 256);
    }
コード例 #4
0
    void OnDrawGizmos()
    {
        if (_isAnotherAgentSelectedInEditor)
        {
            return;
        }

        if (DrawIndicatorAboveAgent && (_lockedInterest != null || _isBored))
        {
            var spheresize = 0.3f;
            var frequency  = 3;
            if (_currentState == State.DoingTransaction || _currentState == State.DoingPersonTransaction)
            {
                spheresize = spheresize * Mathf.Abs(Mathf.Sin(frequency * Time.time));
            }

            Gizmos.color = _isBored && _currentState != State.DoingTransaction ? Color.red : _lockedInterest.Color;
            Gizmos.DrawWireSphere(transform.position + 3f * Vector3.up, spheresize);
        }

        if (DrawSocialInteractionRadii)
        {
            Gizmos.color = AgentCategory.Color * new Color(1, 1, 1, SocialInteractionRadiiAlpha);
            GizmoHelper.DrawGizmoCircle(SocialTransactionRadius, transform.position);
            GizmoHelper.DrawGizmoCircle(SocialInteractionRadius, transform.position);
        }
    }
コード例 #5
0
 void OnDrawGizmos()
 {
     if (_conwayPoly == null)
     {
         return;
     }
     GizmoHelper.DrawGizmos(_conwayPoly, transform, vertexGizmos, faceGizmos, edgeGizmos, faceCenterGizmos, false, 0.3f);
 }
コード例 #6
0
        void OnDrawGizmosSelected()
        {
            Gizmos.color = Color.cyan;
            Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);

            Gizmos.matrix = rotationMatrix;
            GizmoHelper.DrawWireCapsule(transform.position, transform.rotation, Radius, Height, Color.cyan);
        }
コード例 #7
0
ファイル: ExampleBase.cs プロジェクト: IxxyXR/polyhydra-upm
 public virtual void DoDrawGizmos()
 {
     if (poly == null)
     {
         return;
     }
     #if UNITY_EDITOR
     GizmoHelper.DrawGizmos(poly, transform, vertexGizmos, faceGizmos, edgeGizmos, faceCenterGizmos, FaceOrientationGizmos, 0.3f);
     #endif
 }
コード例 #8
0
        public override void OnDrag()
        {
            base.OnDrag();

            //Get the angle between the points
            float angle = GizmoHelper.AngleBetweenTwoPoints(objectPositionOnScreen, mousePositionOnScreen);

            var rotation = Quaternion.Euler(new Vector3(0f, -angle, 0f));

            SelectionHandler.instance.CurrentSelection.gameObject.transform.parent.rotation = rotation;
            transform.root.rotation = rotation;
        }
コード例 #9
0
 public virtual void SetAsSelected()
 {
     try
     {
         GizmoHelper.SetAsSelected(_node, _gizmo, _scene);
     }
     catch (PulsarGizmoException selectedGizmoException)
     {
         selectedGizmoException.Source  = "[BaseEntity:SetAsSelected]";
         selectedGizmoException.Message = "Failed to set Gizmo as selected.";
         throw selectedGizmoException;
     }
     _isSelected = true;
 }
コード例 #10
0
    private void OnDrawGizmosSelected()
    {
        if (gizmoHelper == null)
        {
            gizmoHelper = GameObject.Find("[GizmoHelper]").GetComponent <GizmoHelper>();
        }

        if (boxCollider2D == null)
        {
            boxCollider2D = GetComponent <BoxCollider2D>();
        }

        gizmoHelper.DrawCube(transform.position, Color.Lerp(Color.red, Color.yellow, 0.5f), new Vector2(boxCollider2D.size.x + (pixelWidth / 12), boxCollider2D.size.y + (pixelHeight / 12)), transform.eulerAngles);
    }
コード例 #11
0
        public virtual void UnSelect()
        {
            Debug.Print("BaseEntity.UnSelect - Calling GizmoHelper.UnSelect...");
            try
            {
                GizmoHelper.UnSelect(_node, _gizmo);
            }
            catch (PulsarGizmoException unSelectGizmoException)
            {
                unSelectGizmoException.Source  = "[BaseEntity:SetAsSelected]";
                unSelectGizmoException.Message = "Failed to set Gizmo as selected.";
                throw unSelectGizmoException;
            }

            Debug.Print("BaseEntity.UnSelect - Setting _isSelected of " + Name + " to False");
            _isSelected = false;
        }
コード例 #12
0
 private void OnDrawGizmos()
 {
     #if UNITY_EDITOR
     // Gizmos.color = Color.green;
     // for (var i = 0; i < loop.Count; i++)
     // {
     //     var f = loop[i];
     //     var face = poly.Faces[f.Item1];
     //     var edges = face.GetHalfedges();
     //     var edge = edges[ConwayPoly.ActualMod(f.Item2, edges.Count)];
     //     var pos = edge.Midpoint;
     //     pos = transform.TransformPoint(pos);
     //     Gizmos.DrawWireSphere(pos, .03f);
     //     Handles.Label(pos + new Vector3(0, .15f, 0), i.ToString());
     // }
     GizmoHelper.DrawGizmos(poly, transform, vertexGizmos: false, edgeGizmos: false);
     #endif
 }
コード例 #13
0
    void OnDrawGizmos()
    {
        Gizmos.color = InterestCategory.Color;
        GizmoHelper.DrawGizmoCircle(OuterVisibilityRadius, transform.position);
        GizmoHelper.DrawGizmoCircle(InnerSatisfactionRadius, transform.position);


        var category = InterestCategory.name;

        Label.text = category;
        var gameObjectName = category + "- AttractionZone";

        if (gameObject.name != gameObjectName)
        {
            gameObject.name = gameObjectName;
        }

        Label.color = InterestCategory.Color;
    }
コード例 #14
0
 public void SetMaterial(PulsarMaterial material)
 {
     if (material != null)
     {
         _model.SetMaterial(material.Material);
         if (_baseEntity != null)
         {
             Component existingComponent = _baseEntity.Components.ToList().Find(component => component.Equals(material));
             if (existingComponent == null)
             {
                 _baseEntity.AddComponent(material);
             }
             else
             {
                 //if in select mode, the Gizmo handles the temporary material which will need updating
                 GizmoHelper.UpdateTemporaryMaterialStore(_model.Node, material.Material);
             }
         }
     }
 }
コード例 #15
0
    private void OnDrawGizmosSelected()
    {
        if (gizmoHelper == null)
        {
            gizmoHelper = GameObject.Find("[GizmoHelper]").GetComponent <GizmoHelper>();
        }

        if (collider == null)
        {
            collider = GetComponent <BoxCollider2D>();
        }

        if (initialPosition == Vector2.zero)
        {
            initialPosition = transform.position;
        }

        foreach (Vector2 pos in positions)
        {
            gizmoHelper.DrawCube(initialPosition + pos, (pos == positions[positionIndex] ? Color.cyan : Color.red), collider.size);
        }
    }
コード例 #16
0
 void OnDrawGizmos()
 {
     GizmoHelper.DrawGizmos(poly, transform, vertexGizmos, faceGizmos, edgeGizmos, faceCenterGizmos, false, 0.3f);
     if (shapeGizmos)
     {
         for (int i = 0; i < shapes.Count; i++)
         {
             // if (i != ShapeGizmoIndex) continue;
             var shape = shapes[i];
             for (int j = 0; j < shape.Count; j++)
             {
                 // if (j != EdgeGizmoIndex) continue;
                 Gizmos.color = Color.yellow;
                 Vector3 vv1    = transform.TransformPoint(shape[j]);
                 var     vv2    = transform.TransformPoint(shape[(j + 1) % shape.Count]);
                 var     v1     = new Vector3(vv1.x, 0, vv1.y);
                 var     v2     = new Vector3(vv2.x, 0, vv2.y);
                 var     center = v1 + .2f * ((v2 - v1) / 2f);
                 Gizmos.DrawLine(v1, v2);
                 Gizmos.DrawWireSphere(center, .01f);
             }
         }
     }
 }
コード例 #17
0
 public virtual void UnSelect()
 {
     GizmoHelper.UnSelect(_node, _gizmo);
     _isSelected = false;
 }
コード例 #18
0
 public virtual void SetAsSelected()
 {
     GizmoHelper.SetAsSelected(_node, _gizmo, _scene);
     _isSelected = true;
 }
コード例 #19
0
 public static void RemoveHelper(GizmoHelper helper)
 {
     helpers.Remove(helper);
 }
コード例 #20
0
ファイル: TowersTest.cs プロジェクト: IxxyXR/polyhydra-upm
 void OnDrawGizmos()
 {
     GizmoHelper.DrawGizmos(poly, transform, true, false, false);
 }
コード例 #21
0
 private void Start()
 {
     collider    = GetComponent <BoxCollider2D>();
     gizmoHelper = GameObject.Find("[GizmoHelper]").GetComponent <GizmoHelper>();
 }
コード例 #22
0
 void OnDrawGizmos()
 {
     GizmoHelper.DrawGizmos(poly, transform, VertexGizmos, FaceGizmos, EdgeGizmos, FaceCenterGizmos);
 }