public PlayGridElement Get(PlayGridElement element, int offset)
 {
     if (Contains(element.Index + offset))
     {
         return(Elements[element.Index + offset]);
     }
     else
     {
         return(null);
     }
 }
        public void Init(PlayGridElement origin)
        {
            this.origin = origin;

            if (target == null)
            {
                throw new NullReferenceException("No Target specified for transition: " + this.name);
            }

            InitDirection();

            InstantiateConnection();
        }
Example #3
0
        public IEnumerator Move(PlayGridElement target)
        {
            while (Progress != target.Index)
            {
                var direction = Math.Sign(target.Index - CurrentElement.Index);

                var nextElement = Grid[Progress + direction];

                yield return(MoveTo(nextElement.Position));

                Progress = nextElement.Index;

                yield return(new WaitForSeconds(0.05f));
            }
        }
        IEnumerator Procedure(Pawn pawn, PlayGridElement current, PlayGridElement target)
        {
            if (target == null)
            {
                yield return(new WaitForSeconds(0.5f));
            }
            else
            {
                yield return(coroutines.Yield(pawn.Move(target)));

                while (pawn.CurrentElement.Transition != null)
                {
                    yield return(coroutines.Yield(pawn.Transition(pawn.CurrentElement.Transition)));
                }
            }

            if (PhotonNetwork.IsMasterClient)
            {
                photonView.RPC(nameof(TurnEnd), RpcTarget.All, pawn.ID, pawn.Progress);
            }
        }