protected override void DoEffect(PlayerController user) { base.DoEffect(user); GameObject obj = Instantiate(CustomCreepyEyeController.eyePrefab, user.CenterPosition, Quaternion.identity); CustomCreepyEyeController eye = obj.GetComponent <CustomCreepyEyeController>(); eye.ChangeScale(0.5f); eye.transform.parent = user.transform; this.m_extantEye = obj; base.StartCoroutine(ItemBuilder.HandleDuration(this, 15f, user, this.OnFinish)); }
public static void Build() { GameObject eye = UnityEngine.Object.Instantiate(((GameObject)BraveResources.Load("Global Prefabs/CreepyEye_Room", ".prefab")).GetComponentInChildren <CreepyEyeController>().gameObject); eye.SetActive(false); FakePrefab.MarkAsFakePrefab(eye); UnityEngine.Object.DontDestroyOnLoad(eye); CreepyEyeController controller = eye.GetComponent <CreepyEyeController>(); CustomCreepyEyeController customController = eye.gameObject.AddComponent <CustomCreepyEyeController>(); customController.MaxPupilRadius = controller.MaxPupilRadius; customController.layers = controller.layers; customController.poopil = controller.poopil; customController.baseSprite = controller.baseSprite; if (eye.GetComponent <SpeculativeRigidbody>() != null) { eye.GetComponent <SpeculativeRigidbody>().CollideWithOthers = false; eye.GetComponent <SpeculativeRigidbody>().CollideWithTileMap = false; } Destroy(controller); CustomCreepyEyeController.eyePrefab = eye; }
public override void Update() { base.Update(); if (this.m_pickedUp && this.LastOwner != null) { if (this.m_isCurrentlyActive) { if (this.m_extantEye == null) { GameObject obj = Instantiate(CustomCreepyEyeController.eyePrefab, this.LastOwner.CenterPosition, Quaternion.identity); CustomCreepyEyeController eye = obj.GetComponent <CustomCreepyEyeController>(); eye.ChangeScale(0.5f); eye.transform.parent = this.LastOwner.transform; this.m_extantEye = obj; } if (this.LastOwner.healthHaver != null) { this.LastOwner.healthHaver.IsVulnerable = false; } this.LastOwner.SetIsFlying(true, "KaliberAffliction", false, false); this.LastOwner.ToggleRenderer(false, "KaliberAffliction"); this.LastOwner.ToggleGunRenderers(false, "KaliberAffliction"); this.LastOwner.ToggleHandRenderers(false, "KaliberAffliction"); this.LastOwner.IsGunLocked = true; BraveInput input = BraveInput.GetInstanceForPlayer(this.LastOwner.PlayerIDX); if (input != null) { if (this.m_extantBeam == null && this.LastOwner.PlayerHasActiveSynergy("#DEAD_GAZE")) { this.m_extantBeam = this.BeginFiringBeam(Toolbox.GetGunById(689).DefaultModule.GetCurrentProjectile(), this.LastOwner, BraveMathCollege.Atan2Degrees(this.LastOwner.unadjustedAimPoint.XY() - this.m_extantEye.GetComponent <CustomCreepyEyeController>().poopil.GetComponent <tk2dBaseSprite>().WorldCenter), this.m_extantEye.GetComponent <CustomCreepyEyeController>().poopil.GetComponent <tk2dBaseSprite>().WorldCenter); this.m_extantBeam.projectile.baseData.damage *= 0.25f; } if (this.m_extantBeam != null) { this.ContinueFiringBeam(this.m_extantBeam, this.LastOwner, BraveMathCollege.Atan2Degrees(this.LastOwner.unadjustedAimPoint.XY() - this.m_extantEye.GetComponent <CustomCreepyEyeController>().poopil.GetComponent <tk2dBaseSprite>().WorldCenter), this.m_extantEye.GetComponent <CustomCreepyEyeController>().poopil.GetComponent <tk2dBaseSprite>().WorldCenter); } if (!input.ActiveActions.GetActionFromType(GungeonActions.GungeonActionType.Shoot).IsPressed) { this.mousePressedLast = false; } if (input.ActiveActions.GetActionFromType(GungeonActions.GungeonActionType.Shoot).IsPressed&& !this.mousePressedLast) { this.mousePressedLast = true; RoomHandler room = this.LastOwner.unadjustedAimPoint.XY().GetAbsoluteRoom(); if (room != null) { room.ApplyActionToNearbyEnemies(this.LastOwner.unadjustedAimPoint.XY(), 0.5f, this.MarkNearbyEnemies); } } } else { if (this.m_extantBeam != null) { this.CeaseBeam(this.m_extantBeam); this.m_extantBeam = null; } this.mousePressedLast = false; } } else { if (this.m_extantBeam != null) { this.CeaseBeam(this.m_extantBeam); this.m_extantBeam = null; } } } else { if (this.m_extantBeam != null) { this.CeaseBeam(this.m_extantBeam); this.m_extantBeam = null; } } if (this.cooldownRemaining > 0) { this.cooldownRemaining = Mathf.Max(0, this.cooldownRemaining - BraveTime.DeltaTime); } if (this.cooldownRemaining <= 0) { if (this.markedEnemies.Count > 0) { this.EatEnemy(this.markedEnemies[0]); this.markedEnemies.RemoveAt(0); this.cooldownRemaining = 5f; } } }