コード例 #1
0
    /// <summary>
    /// Changes characteristics about the character based on what they're
    /// evolving into.
    /// </summary>
    /// <param name="evolutionType"></param>
    public void Evolve(EvolutionType evolutionType)
    {
        Evolution evolution = ReferenceManager.Instance.evolutionLibrary
                              .GetComponent <EvolutionLibrary>().GetEvolution(evolutionType);

        SetCameraPosition(evolution.cameraZ);
        col.radius  = evolution.colliderRadius;
        rend.sprite = evolution.sprite;
        rb.mass     = evolution.mass;

        character.healthProperties.health = Mathf.RoundToInt(
            evolution.CalculateMaximumHealth() *
            Difficulty.Instance.GetHealthMult(gameObject)
            );
        character.movementProperties.speed = Mathf.RoundToInt(
            evolution.CalculateMaximumSpeed() *
            Difficulty.Instance.GetSpeedMult(gameObject)
            );

        foreach (Transform child in transform)
        {
            child.localScale = transform.localScale * evolution.CalculateStatMul();
        }

        character.evolutionProperties.CurrentEvolution = evolution;
    }