Ejemplo n.º 1
0
        private void updateArrowHead(VisibilityController.Visibility vis)
        {
            if (realArrowHead == null)
            {
                realArrowHead = (GameObject)Instantiate(arrowHead, transform.position, Quaternion.identity);

                Vector2 nodeOnePosition = new Vector2(Edge.nodeOne.transform.position.x, Edge.nodeOne.transform.position.y);
                Vector2 nodeTwoPosition = new Vector2(Edge.nodeTwo.transform.position.x, Edge.nodeTwo.transform.position.y);
                Vector2 edgeVector      = nodeTwoPosition - nodeOnePosition;
                float   edgeAngle       = Vector2.Angle(Vector2.right, edgeVector);
                if (Vector3.Cross(Vector2.right, edgeVector).z < 0)
                {
                    edgeAngle *= -1;
                }
                realArrowHead.transform.Rotate(Vector3.forward, edgeAngle);
            }

            realArrowHead.SetActive(viewAsOwned(vis));

            EdgeData.EdgeDirection simplePrev = (prevDirection == EdgeData.EdgeDirection.TwoToOne ? EdgeData.EdgeDirection.TwoToOne : EdgeData.EdgeDirection.OneToTwo);
            EdgeData.EdgeDirection simpleDir  = (Edge.direction == EdgeData.EdgeDirection.TwoToOne ? EdgeData.EdgeDirection.TwoToOne : EdgeData.EdgeDirection.OneToTwo);
            if (simplePrev != simpleDir)
            {
                realArrowHead.transform.Rotate(Vector3.forward, 180);
                prevDirection = Edge.direction;
            }

            updateVisibilityRendering();
        }
Ejemplo n.º 2
0
        protected override void doActivate(Targetable target)
        {
            //pick a random amount to increase visibility by
            EdgeData.EdgeDirection dir = ((EdgeData)target).direction;
            bool  owned = dir == EdgeData.EdgeDirection.OneToTwo || dir == EdgeData.EdgeDirection.TwoToOne;
            float max   = owned ? maxVisIncreaseOwned : maxVisIncreaseUnowned;
            float visibilityIncreaseAmount = UnityEngine.Random.value * (max - minVisIncrease) + minVisIncrease;

            ((EdgeData)target).Visibility += visibilityIncreaseAmount;
        }
Ejemplo n.º 3
0
 protected void Awake()
 {
     prevDirection = EdgeData.EdgeDirection.Neutral;
 }