예제 #1
0
        private void moveController(Vector2 input, float speedUnitsPerSecond)
        {
            Vector3 moveAmount = transform.forward * input.y + transform.right * input.x;

            // perform collision detection (to override default Unity char controller's 'slide along walls' for
            // LSD's janky 'lets just stop in place')
            if (movingIntoWall(moveAmount))
            {
                // we shouldn't move anymore
                moveAmount = Vector3.zero;

                // check to see if we should link
                if (_timeColliding > LinkDelay && _canLink)
                {
                    _canLink = false;
                    DreamSystem.Transition(RandUtil.RandColor());
                }
            }
            else
            {
                _timeColliding = 0;
            }

            // apply the movement speed
            moveAmount *= speedUnitsPerSecond;

            // move the controller
            _controller.Move(moveAmount * Time.deltaTime);
        }
예제 #2
0
        public void OnTriggerEnter(Collider other)
        {
            if (!other.gameObject.CompareTag("Player"))
            {
                return;
            }

            if (!ForceFadeColor)
            {
                ForcedLinkColor = RandUtil.RandColor();
            }
            DreamSystem.Transition(ForcedLinkColor, LinkedLevel, PlayLinkSound, SpawnPointEntityID);
        }
예제 #3
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         PlayerLinker linker = other.GetComponent <PlayerLinker>();
         if (LinkToSpecificLevel)
         {
             linker.Link(LinkedLevel, ForceFadeColor ? ForcedLinkColor : RandUtil.RandColor(), PlayLinkSound, ForceSpawnPoint ? SpawnPointName : "");
         }
         else
         {
             linker.Link(PlayLinkSound);
         }
     }
 }
예제 #4
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);
            }
        }
예제 #5
0
        private void SetToRandom()
        {
            SunDomeObject.SetActive(true);
            SunburstEffect.SetActive(true);
            GradientObject.SetActive(true);
            CloudParticleSystem.SetActive(true);

            _skyMaterial.SetColor("_Tint", RandUtil.RandColor());
            Color fogColor = RandUtil.RandColor();

            // alpha must be preserved for poly clipping distance setting in shaders
            RenderSettings.fogColor = new Color(fogColor.r, fogColor.g, fogColor.b, RenderSettings.fogColor.a);
            _gradientMaterial.SetColor("_Tint", fogColor);
            Color sunColor = RandUtil.RandColor();

            _sunMaterial.SetColor("_Tint", sunColor);
            _sunburstMaterial.SetColor("_Tint", sunColor);
            foreach (Material m in _cloudMaterials)
            {
                m.SetColor("_Tint", Color.white);
            }
        }
예제 #6
0
        public void UpdateEnvironment()
        {
            if (EnvironmentEntity == null)
            {
                Debug.LogWarning("Level has no dream_environment entity! Colors will be random.");
                SetToRandom();
                return;
            }

            Color skyColor   = EnvironmentEntity.ForceSkyColor ? EnvironmentEntity.SkyColor : RandUtil.RandColor();
            Color fogColor   = EnvironmentEntity.ForceFogColor ? EnvironmentEntity.FogColor : RandUtil.RandColor();
            Color sunColor   = EnvironmentEntity.ForceSunColor ? EnvironmentEntity.SunColor : RandUtil.RandColor();
            Color cloudColor = EnvironmentEntity.ForceCloudColor ? EnvironmentEntity.CloudColor : Color.white;

            _skyMaterial.SetColor("_Tint", skyColor);
            RenderSettings.fogColor = new Color(fogColor.r, fogColor.g, fogColor.b, RenderSettings.fogColor.a);
            _gradientMaterial.SetColor("_Tint", fogColor);
            _sunMaterial.SetColor("_Tint", sunColor);
            _sunburstMaterial.SetColor("_Tint", sunColor);
            foreach (Material m in _cloudMaterials)
            {
                m.SetColor("_Tint", cloudColor);
            }

            SunDomeObject.SetActive(EnvironmentEntity.UseSun);
            SunburstEffect.SetActive(EnvironmentEntity.UseSunburst);
            GradientObject.SetActive(EnvironmentEntity.UseGradient);
            CloudParticleSystem.SetActive(EnvironmentEntity.UseClouds);
        }
예제 #7
0
 public void Link(bool playSound = true)
 {
     Link(RandUtil.RandomLevelFromDir(DreamJournalManager.CurrentJournal), RandUtil.RandColor(), playSound);
 }
예제 #8
0
 public void Link(string dreamFilePath)
 {
     Link(dreamFilePath, RandUtil.RandColor());
 }