Example #1
0
    /// <summary>
    /// Load the skill data from the serialized object and
    /// reapply the loaded data to the active player's renderer.
    /// </summary>
    /// <param name="serializedObj">object with the player's visual's saved data</param>
    public override void Load(object serializedObj)
    {
        // Cast the data
        PlayerScaleVisualsSaveData data = serializedObj as PlayerScaleVisualsSaveData;

        // Change the shape of the player
        ShapeData.ShapeType shapeType = data.GetShapeType();
        blendTransitioner.ChangeShapeInstant(shapeType);
        // Change the color of the player
        Color color = data.GetColor();

        meshRenderer.material       = new Material(meshRenderer.material);
        meshRenderer.material.color = color;
    }
    /// <summary>Shows the cannot fit visual at the given position as the given size and shape.</summary>
    /// <param name="pos">Position to move the cannot fit visual to.</param>
    /// <param name="size">Shape size to set.</param>
    /// <param name="rotation">Rotation of the shape.</param>
    /// <param name="shapeType">ShapeType to set the cannot fit visual to.</param>
    public void Activate(Vector3 pos, Vector3 size, float rotation, ShapeData.ShapeType shapeType)
    {
        // Move to the player's position.
        transform.position = pos;
        // Rotate the shape
        Vector3 angles = transform.eulerAngles;

        angles.z = rotation;
        transform.eulerAngles = angles;
        // Make it fit the size and shape the player attempted to change to.
        scaleCont.ShapeScale = size;
        blendTrans.ChangeShapeInstant(shapeType);

        StartFadeOutCoroutine();
    }