Exemplo n.º 1
0
 public static void BeginDream()
 {
     if (GraphSquares.Count > 0)
     {
         int    xPos = (int)GraphSquares[GraphSquares.Count - 1].x;
         int    yPos = (int)GraphSquares[GraphSquares.Count - 1].y;
         string level;
         if (GetLevelFromGraphPosition(xPos, yPos, out level))
         {
             BeginDream(level);
             return;
         }
     }
     BeginDream(RandUtil.RandomLevelFromDir(DreamJournalManager.CurrentJournal));
 }
Exemplo n.º 2
0
        public void OnControllerColliderHit(ControllerColliderHit hit)
        {
            // TODO
            //if (DreamDirector.Payload.DreamEnded) return;

            if (!hit.gameObject.tag.Equals("Linkable"))
            {
                return;
            }

            // if we're not touching a wall, reset the link delay timer
            // (this works because when you touch a wall and the floor, the collisions alternate)
            // basically, if we are touching the floor for 2 collisions in a row, we can reasonably
            // assume we are not also touching a wall
            if (_touchingFloor && hit.normal == Vector3.up)
            {
                _linkTimer = 0;
            }

            // remember if we were touching the floor on the last collision
            _touchingFloor = hit.normal == Vector3.up;

            // make sure we are facing the collision
            if (Vector3.Dot(transform.forward, hit.moveDirection) <= 0.75F)
            {
                return;
            }

            if (!_canLink)
            {
                return;
            }
            _linkTimer += Time.deltaTime;
            if (_linkTimer > LinkDelay)
            {
                LinkableObject o = hit.gameObject.transform.parent.transform.parent.GetComponent <LinkableObject>();

                Color  linkCol   = o.ForceFadeColor ? o.FadeColor : RandUtil.RandColor();
                string linkLevel = o.LinkToSpecificLevel ? IOUtil.PathCombine("levels", o.LinkedLevel) : RandUtil.RandomLevelFromDir(DreamJournalManager.CurrentJournal);

                _linkTimer = 0;
                Link(linkLevel, linkCol);
            }
        }
Exemplo n.º 3
0
 public void Link(bool playSound = true)
 {
     Link(RandUtil.RandomLevelFromDir(DreamJournalManager.CurrentJournal), RandUtil.RandColor(), playSound);
 }