62 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
/*
 | 
						|
文件名:MonsterObjectClass.nut
 | 
						|
路径:User/GameClass/ObjectClass/MonsterObjectClass.nut
 | 
						|
创建日期:2024-05-10	19:40
 | 
						|
文件用途:怪物对象类
 | 
						|
*/
 | 
						|
class GameObject.Monster extends GameObject.ActiveObject {
 | 
						|
 | 
						|
    Attackinfo = null;
 | 
						|
    //怪物Id
 | 
						|
    Id = null;
 | 
						|
 | 
						|
    //属性表
 | 
						|
    Attribute = null;
 | 
						|
 | 
						|
 | 
						|
    function Init(Idx) {
 | 
						|
        Id = Idx;
 | 
						|
        Info = ScriptData.GetMonster(Idx);
 | 
						|
 | 
						|
        base.Init(Info);
 | 
						|
 | 
						|
        //构造属性对象
 | 
						|
        Attribute = AttributeClass();
 | 
						|
        //加载脚本属性
 | 
						|
        Attribute.Init(Info.Attributes, this);
 | 
						|
 | 
						|
        //如果存在Atk 初始化所有Atk
 | 
						|
        if ("attackinfo" in Info) {
 | 
						|
            Attackinfo = [];
 | 
						|
            foreach(_index, path in Info.attackinfo) {
 | 
						|
                // local AniBuf = Animation(path);
 | 
						|
                // AniBuf.ShowBorder(true);
 | 
						|
                Attackinfo.append(path);
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
    function OnAddchild(Parent) {
 | 
						|
        getroottable().MonsterObjectFunction["MonsterObject_Create_" + Id](this, Parent);
 | 
						|
        base.OnAddchild(Parent);
 | 
						|
    }
 | 
						|
 | 
						|
    function OnRemove(Parent) {
 | 
						|
        getroottable().MonsterObjectFunction["MonsterObject_Destroy_" + Id](this, Parent);
 | 
						|
        base.OnRemove(Parent);
 | 
						|
    }
 | 
						|
 | 
						|
    //被调用
 | 
						|
    function OnUpdate(dt) {
 | 
						|
        //调用怪物Proc状态
 | 
						|
        getroottable().MonsterObjectFunction["MonsterObject_Proc_" + Id](this, dt);
 | 
						|
        //属性更新
 | 
						|
        if (Attribute) Attribute.Proc(this, dt);
 | 
						|
        //原始逻辑
 | 
						|
        base.OnUpdate(dt);
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
} |