Ejemplo n.º 1
0
    /// <summary>
    /// Returns pawn of type newForm, if it exists. If it doesn't, a new pawn is loaded from the respective AssetBundle and created.
    /// </summary>
    /// <param name="newForm">The type of pawn to return.</param>
    /// <returns>Pawn of type newForm.</returns>
    public GameObject GetNewPawn(PlayerController.Form newForm)
    {
        switch (newForm)
        {
        case PlayerController.Form.Human:
            return(humanPawn);

        case PlayerController.Form.Bear:
            if (bearPawn == null)
            {
                bearPawn = Instantiate(pecoBearBundle.LoadAsset <GameObject>("PecoBear"));
            }
            return(bearPawn);

        case PlayerController.Form.Test:
            if (testPawn == null)
            {
                testPawn = Instantiate(pecoTestBundle.LoadAsset <GameObject>("TestCapsule"));
            }
            return(testPawn);

        default:
            Debug.Log("Attempting to switch to form that is not set up in FormManager.");
            return(null);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Sets the player's formData to the data for form newForm.
    /// </summary>
    public void GetNewData(PlayerController.Form newForm)
    {
        switch (newForm)
        {
        case PlayerController.Form.Human:
            player.formData = formBundle.LoadAsset <FormDataBase>("TestCapsuleData");
            return;

        case PlayerController.Form.Bear:
            player.formData = formBundle.LoadAsset <FormDataBase>("BearData");
            return;

        case PlayerController.Form.Test:
            player.formData = formBundle.LoadAsset <FormDataBase>("TestCapsuleData");
            return;

        default:
            Debug.Log("Attempting to switch to form that is not set up in FormManager.");
            return;
        }
    }