Beispiel #1
0
        public UnitBase(WorldSpace ws, int templateID, int campID, int level)
        {
            this.ID          = id;
            this.mWorldSpace = ws;
            this.TemplateID  = templateID;
            this.CampID      = campID;
            var config = ConfigManager.Unit.getRow(templateID);

            this.HP     = config.MaxHP;
            this.MaxHP  = config.MaxHP;
            this.IsDead = false;

            ATK            = new Attribute(config.Attack, null);
            radius         = config.Radius;
            MoveSpeed      = new Attribute(config.MoveSpeed, null);
            AttackDuration = new AttackDuration(config.AttackDuration, null);
            AttackRange    = new DistanceAttribute(config.AttackRange, null);
            VisualRange    = new DistanceAttribute(config.VisualRange, null);
            Bullet         = config.Bullet;
            if (config.Skills != null)
            {
                mSkills = new Skill[config.Skills.Length];
            }
            else
            {
                mSkills = new Skill[0];
            }
            for (int i = 0; i < mSkills.Length; ++i)
            {
                mSkills[i] = new Skill(this, config.Skills[i], level);
            }
            InitController();
            InitBehaviorTree();
            Animator = new AnimatorController(config.Animator);
        }
    static int set_AttackDuration(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BattleSystem.ObjectModule.UnitBase       obj  = (BattleSystem.ObjectModule.UnitBase)o;
            BattleSystem.ObjectModule.AttackDuration arg0 = (BattleSystem.ObjectModule.AttackDuration)ToLua.CheckObject <BattleSystem.ObjectModule.AttackDuration>(L, 2);
            obj.AttackDuration = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AttackDuration on a nil value"));
        }
    }
    static int get_AttackDuration(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BattleSystem.ObjectModule.UnitBase       obj = (BattleSystem.ObjectModule.UnitBase)o;
            BattleSystem.ObjectModule.AttackDuration ret = obj.AttackDuration;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AttackDuration on a nil value"));
        }
    }