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_AttackRange(IntPtr L)
    {
        object o = null;

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

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