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 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();
        }
    }
Exemplo n.º 4
0
    public void OnListenerTrigger(Collider coll)
    {
        WizardKingSolo wizardKingSolo = coll.gameObject.GetComponent <WizardKingSolo>();

        if (wizardKingSolo)
        {
            GetComponent <BulkyGuyCharacterControl>().SetCarryingKing();
            Destroy(wizardKingSolo.gameObject);
        }
    }
Exemplo n.º 5
0
    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);
    }