void Update() { if (Input.GetAxis("Jump") != 0) { if (this.firedAlready) { // We are done... (animation is still playing) return; } this.firedAlready = true; // For some reason, using triggers in Animator (state-machine) // causes the next part to break... (disappoint) animator.Play("Standstill to Lift"); // Create a new lantern to lift-off GameObject lantern = GameObject.Instantiate(LanternPrefab, this.transform.position, Quaternion.Euler(-90, 0, 0)); LanternController lanternController = lantern.GetComponent <LanternController>(); lanternController.setTrackingTransform(this.ReferencePoint, this.PlacementOffset); // Lantern says "Notice me senpai~~" // (joke, camera needs to look at lantern) // speed factor >= 0.5 (because that is the speed the lantern is moving at...) this.Camera.LerpToNewTarget(lantern, 0.78f); } }
//I wanted to change the lights falloff range but for some reason unity does not support this feature. public override void Use() { //base.Use(); existingLight = FindObjectOfType <LanternController>(); //Cant seem to get this to work outside of the use function. isLanternOn = !isLanternOn; if (isLanternOn == true) { icon = onSprite; } else { icon = offSprite; } FindObjectOfType <InventoryUI>().UpdateUI(); existingLight.lt.color = lanternColor; existingLight.lt.intensity = lanternIntensity; existingLight.lt.pointLightInnerRadius = lanternRadiusInner; existingLight.lt.pointLightOuterRadius = lanternRadiusOuter; existingLight.ToggleLantern(); }
void Awake() { current = this; }