コード例 #1
0
    // Use this for initialization
    void Start()
    {
        Liquid water = ScriptableObject.CreateInstance <Liquid>(); //5, Color.white, LiquidType.Water);

        water.init(1, Color.white, LiquidType.Water);

        Solution solution = ScriptableObject.CreateInstance <Solution>();

        solution.addToSolution(water);


        solutionToAdd = solution;
    }
コード例 #2
0
    /// <summary>
    /// Solution copy ctor.
    /// </summary>
    /// <param name="other"></param>
    public void init(Solution other)
    {
        //Set temperature.
        this.temperature = other.temperature;

        for (int i = 0; i < other.liquidComponents.Count; i++)
        {
            Liquid newLiquid = ScriptableObject.CreateInstance <Liquid>();
            newLiquid.init(other.liquidComponents[i]);

            this.liquidComponents.Add(newLiquid);
        }
        currentAmount = other.currentAmount;
    }