CW_Asset_Element 初始化方法详解:添加资源元素
这是一个初始化方法,用于添加 CW_Asset_Element 对象到某个类中。
首先调用 base.init() 来调用父类的初始化方法。
然后,使用 add() 方法将多个 CW_Asset_Element 对象添加到类中。每个 CW_Asset_Element 对象都有一个唯一的名称,以及表示不同属性的值(如水、火、木材、铁和地面的数量)。还有一些其他的属性,如速度、力量和成本。
例如,以下代码添加了水、火、木材、铁和地面的基础资源:
add(new CW_Asset_Element('CW_water', 100, 0, 0, 0, 0, 1f, 4.5f, null, 200));
add(new CW_Asset_Element('CW_fire', 0, 100, 0, 0, 0, 1f, 4.5f, null, 200));
add(new CW_Asset_Element('CW_wood', 0, 0, 100, 0, 0, 1f, 4.5f, null, 200));
add(new CW_Asset_Element('CW_iron', 0, 0, 0, 100, 0, 1f, 4.5f, null, 200));
add(new CW_Asset_Element('CW_ground', 0, 0, 0, 0, 100, 1f, 4.5f, null, 200));
之后还添加了组合资源和特殊资源,例如:
add(new CW_Asset_Element('CW_water_fire', 50, 50, 0, 0, 0, 1f, 2.5f, null, 50));
add(new CW_Asset_Element('CW_common', 20, 20, 20, 20, 20, 1f, 3f, null, 0));
add(new CW_Asset_Element('CW_uniform', 20, 20, 20, 20, 20, 20f, 100f, null, -50));
这些 CW_Asset_Element 对象将被用于后续的操作和计算。
原文地址: https://www.cveoy.top/t/topic/peLY 著作权归作者所有。请勿转载和采集!