Beispiel #1
0
 public virtual void OnBullet(Bullet bullet)
 {
     if (LinkTo != null)
     {
         LinkTo.SpawnBullet();
     }
 }
Beispiel #2
0
        public void ChangePath(LinkTo Path, SnapDiagramData linkTo)
        {
            if (Id % 12 == 0)
            {
                LinkTo = LinkTo.No;
                return;
            }

            First = linkTo;

            if (Path == LinkTo.No)
            {
                RowIdFirst = null;
            }

            if (Path == LinkTo.Previous)
            {
                RowIdFirst = null;
                if (Id % 12 == 2)
                {
                    RowIdSecond = null;
                }
                else
                {
                    RowIdFirst = Id % 12 - 1;
                }
            }
            if (Path == LinkTo.PreviousWithDelay)
            {
                RowIdFirst  = (Id % 12 == 2) ? 1 : (int?)null;
                RowIdSecond = 0;
            }

            LinkTo = Path;
        }
        public static T Value <T>(this LinkTo <T> link) where T : Object
        {
#if USE_ADDRESSABLES
            return(AddrHelper.GetAsset <T>(link));
#else
            return(link.Value);
#endif
        }
Beispiel #4
0
        public virtual ActionResult Add(PostAdd postAdd)
        {
            if (ModelState.IsValid)
            {
                var post = new Post();
                Mapper.Map(postAdd, post);
                post.CreatedAt = DateTime.UtcNow;
                RavenSession.Store(post);
                return(RedirectToAction(LinkTo.Post(post)));
            }

            return(View());
        }
Beispiel #5
0
    public override void UnlinkHue(Structure hue)
    {
        if (Hues.Count > 0)
        {
            OldHue = CurrentHue;
        }

        base.UnlinkHue(hue);

        if (Hues.Count == 0)
        {
            capsule.transform.localPosition = -2500 * Vector3.up;
            Wait.Until(t =>
            {
                var step = Easing.EaseOut(Mathf.Clamp01(t * 4), EasingType.Cubic);
                capsule.transform.localPosition = Vector3.Lerp(-2500 * Vector3.up, Vector3.zero, 1 - step);
                return(step >= 1);
            }, () =>
            {
                capsule.transform.localPosition = Vector3.zero;

                if (LinkTo != null)
                {
                    var or = LinkTo.OldResource;

                    LinkTo.Unlink();

                    //Structures.Add(or);
                    if (or != null)
                    {
                        or.Reset();
                    }
                }

                Dispose();
                Destroy(gameObject);
            });
        }
        else
        {
            PropagateHue();
        }
    }
Beispiel #6
0
 public LinksToAttribute(LinkTo linkType)
 {
     LinkType = linkType;
 }
Beispiel #7
0
        /// <summary>
        ///     Draw line according to routing strategy
        /// </summary>
        /// <param name="id"> flow id </param>
        /// <param name="linkTo"> routing type </param>
        /// <param name="singleDelayBlock"> if the first delay block uses all delay space available </param>
        /// <param name="hasBackup">If no amplifier, shorter line </param>
        /// <returns> </returns>
        private static PointCollection RouteLine(int id, LinkTo linkTo, bool singleDelayBlock, bool hasBackup)
        {
            if (id > 499)
            {
                return(new PointCollection());
            }
            var flowNdumber = id % 12;
            var y           = flowNdumber % 4;

            int[] ypos   = { 25, 65, 105, 145, 185 };
            int[] xpos   = { 130, 240, 270, 390, 455 };
            int   length = hasBackup ? 1000 : 860;

            if (linkTo == LinkTo.No)
            {
                return new PointCollection
                       {
                           new Point(260, ypos[y]),
                           new Point(length, ypos[y])
                       }
            }
            ;

            if (flowNdumber == 2 && linkTo == LinkTo.PreviousWithDelay && !singleDelayBlock)
            {
                return new PointCollection
                       {
                           new Point(xpos[4], ypos[1]),
                           //from upper linkunit
                           new Point(xpos[4], 80),      //go down half
                           new Point(xpos[3], 80),      //go left one unit
                           new Point(xpos[3], ypos[2]), //go down half
                           new Point(length, ypos[2]),  //go to end
                           //go to end
                       }
            }
            ;

            if ((linkTo == LinkTo.Previous && flowNdumber > 0 && flowNdumber < 3) ||
                ((linkTo == LinkTo.Previous && flowNdumber == 3 && !singleDelayBlock)))
            {
                return new PointCollection
                       {
                           new Point(xpos[3], ypos[y - 1]), //from upper linkunit
                           new Point(xpos[3], ypos[y]),     //go down & attach cards
                           new Point(length, ypos[y])       //go to end
                       }
            }
            ;

            if (linkTo == LinkTo.PreviousWithDelay || linkTo == LinkTo.Previous)
            {
                return new PointCollection
                       {
                           (y == 0)
                                   ? new Point(xpos[4], -15)
                                   : new Point(xpos[4], ypos[y - 1]), //from upper linkunit
                           new Point(xpos[4], ypos[y]),               //go down 1
                           new Point(length, ypos[y])                 //go to end
                       }
            }
            ;


            throw new Exception("No valid routing path found");
        }

        #endregion
    }
}