public override void OnActivated() { Vector3 praisePositionTarget = Vector3.zero; WizardKing wizardKing = SceneUtils.FindObject <WizardKing>(); WizardKingSolo wizardKingSolo = SceneUtils.FindObject <WizardKingSolo>(); if (wizardKingSolo) { praisePositionTarget = wizardKingSolo.transform.position; wizardKingSolo.CannotDie(); } else if (wizardKing) { praisePositionTarget = wizardKing.transform.position; } foreach (Transformer transformer in SceneUtils.FindObjects <Transformer>()) { if (!transformer.IsTranformed()) { Direction directionToKing = MathUtils.GetHorizontalDirection(praisePositionTarget, transformer.transform.position); transformer.GetComponent <BodyControl>().Turn((float)directionToKing); transformer.DoPraise(); } } DeActivate(); }
public void OnCollisionEnter(Collision coll) { WizardKing wizardKing = coll.gameObject.GetComponent <WizardKing>(); Transformer transformer = coll.gameObject.GetComponent <Transformer>(); WizardKingSolo wizardKingSolo = coll.gameObject.GetComponent <WizardKingSolo>(); if (wizardKingSolo) { wizardKingSolo.OnDie(); } if (wizardKing) { wizardKing.OnDie(); } if (transformer) { if (!killsTransformedTransformers) { if (!transformer.IsTranformed()) { transformer.OnDie(); } } else { transformer.OnDie(); } } }
public void OnListenerTrigger(Collider coll) { WizardKing wizardKing = coll.gameObject.GetComponent <WizardKing>(); WizardKingSolo wizardKingSolo = coll.gameObject.GetComponent <WizardKingSolo>(); BulkyGuy bulkyGuy = coll.gameObject.GetComponent <BulkyGuy>(); if (wizardKingSolo) { StartCutScene(null, false); } if (bulkyGuy && bulkyGuy.GetComponent <BulkyGuyCharacterControl>().IsCarryingKing()) { bulkyGuy.GetComponent <PlayerInputComponent>().enabled = false; StartCutScene(bulkyGuy, true); bulkyGuy.GetComponent <CharacterControl>().StandStill(); } if (wizardKing) { StartCutScene(wizardKing, true); wizardKing.GetComponent <PlayerInputComponent>().enabled = false; wizardKing.GetComponent <CharacterControl>().StandStill(); } }
public void OnListenerTrigger(Collider coll) { WizardKingSolo wizardKingSolo = coll.gameObject.GetComponent <WizardKingSolo>(); if (wizardKingSolo) { GetComponent <BulkyGuyCharacterControl>().SetCarryingKing(); Destroy(wizardKingSolo.gameObject); } }
public void DoThrow() { OnThrowing(); Direction direction = GetComponent <BodyControl>().GetDirection(); WizardKingSolo wizardKingSolo = (WizardKingSolo)GameObject.Instantiate(wizardKingSoloPrefab, wizardKingSoloPrefab.transform.position, Quaternion.identity); GetComponent <KingCharacterControl>().SetNotCarryingKing(); GetComponent <KingCharacterControl>().StandStill(); GetComponent <KingCharacterControl>().DisableAnimationSwitching(); PhysicsUtils.IgnoreCollisionBetween(wizardKingSolo.collider, this.collider); wizardKingSolo.gameObject.SetActive(true); wizardKingSolo.transform.parent = null; wizardKingSolo.rigidbody.AddForce(new Vector3(throwPower.x * (float)direction, throwPower.y), ForceMode.Impulse); wizardKingSolo.OnThrown(); DispatchMessage("OnWizardThrown", wizardKingSolo); GetComponent <PlayerInputComponent>().enabled = false; }
public void OnWizardThrown(WizardKingSolo wizardKingSolo) { this.wizardKingSolo = wizardKingSolo; wizardKingSoloIsUsed = true; this.wizardKingSolo.AddEventListener(this.gameObject); }
public void OnWizardSoloDied(WizardKingSolo wizardKingSolo) { Destroy(wizardKingSolo.gameObject); Invoke("RestartLevel", 2f); }