Exemplo n.º 1
0
    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();
    }
Exemplo n.º 2
0
    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 override void OnStart()
    {
        wizardKing = GetComponentInChildren <WizardKing>();

        transformersInGame.ForEach(transformerInGame => transformerInGame.AddEventListener(this.gameObject));
        wizardKing.AddEventListener(this.gameObject);

        characterPicker = GetComponentInChildren <CharacterPicker>();
        characterPicker.AddEventListener(this.gameObject);

        characterPicker.SetTotalAmountOfTransformers(transformersInGame.Count);

        int extraSavedLives = SaveUtil.LoadData();

        livesOutput.text = transformersInGame.Count + extraSavedLives + "";
        livesSaved       = transformersInGame.Count + extraSavedLives;

        if (cutSceneManagerToPlayAtStart)
        {
            cutSceneManagerToPlayAtStart.AddEventListener(this.gameObject);
            cutSceneManagerToPlayAtStart.StartCutScene(true);
        }
        else
        {
            Invoke("InitiateCharacterPickerDelayed", .6f);
        }
    }
    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 OnWizardKingDied(WizardKing wizardKing)
    {
        //let all peasants cheer!
        Destroy(wizardKing.gameObject);

        if (!wizardKingSoloIsUsed)
        {
            Invoke("RestartLevel", 2f);
        }
    }