示例#1
0
// Environment Growth Process and Logic
    private void StageUp(int Max)
    {
        // While its not fully aged
        if (iStage < Max)
        {
            // If the days passed has reach the stae change limit.
            if ((int.Parse(refMapValue.GetMapTimeDate(2)) - iStartDate) > iStageChange)
            {
                // Hide Updating GameObject
                transform.GetComponent <MeshRenderer>().enabled = false;
                // Instantiate Updated GameObject
                Transform tNewEnvironment = Instantiate(tEnvironmentLine.ToArray()[0], transform.position, Quaternion.identity);
                tNewEnvironment.parent = transform.parent;
                // Setting Instantiated values
                tNewEnvironment.GetComponent <Environment>().SetReferences(refCore, refMapValue);
                tNewEnvironment.GetComponent <Environment>().SetReferenceName(strRefName);
                tNewEnvironment.GetComponent <Environment>().SetStageMax(iMaxStage);
                tNewEnvironment.GetComponent <Environment>().SetStageLevel(++iStage);
                tNewEnvironment.GetComponent <Environment>().SetStageChange(iStageChange);
                tNewEnvironment.GetComponent <Environment>().SetStartDate(int.Parse(refMapValue.GetMapTimeDate(2)));
                // Destroy Old GameObject
                Destroy(transform.gameObject);
            }
        }
    }