예제 #1
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;
    }