示例#1
0
    public MonsterInfo(int creatureIndexId, int creatureId, PathInfo _pathInfo)
    {
        Id           = creatureIndexId;
        charId       = creatureId;
        creatureData = J_Creature.GetData(charId);
        charName     = creatureData._modelName;
        if (charName == null)
        {
            Debug.LogError("MonsterModelName" + charId + " is NULL");
        }

        creatureStateMachine = new StateMachine();
        creatureAtk          = new CreatureAtk(this);
        creatureDead         = new CreatureDead(this);
        creatureIdle         = new CreatureIdle(this);
        creatureMove         = new CreatureMove(this);

        hpMax        = creatureData._hp;
        hp           = hpMax;
        attackSpeed  = creatureData._attackSpeed;
        attackDamage = creatureData._attackDamage;
        defenceType  = creatureData._defenceType;
        attackSkill  = SkillManager.getInstance().AddSkill(1, this);
        pathInfo     = _pathInfo;
        curPathNum   = 0;
        //设置初始位置
        position = pathInfo.GetPoint(curPathNum);

        attackTime = AnimationCache.getInstance().getAnimation(charName).getMeshAnimation("attack").getAnimTime();
    }
    public SoliderInfo(int soliderIndexId, int soliderId)
    {
        Id           = soliderIndexId;
        charId       = soliderId;
        creatureData = J_Creature.GetData(charId);
        charName     = creatureData._modelName;
        if (charName == null)
        {
            Debug.LogError("SoliderModelName" + charId + " is NULL");
        }
        soliderStateMachine = new StateMachine();
        soliderAtk          = new SoliderAtk(this);
        soliderDead         = new SoliderDead(this);
        soliderIdle         = new SoliderIdle(this);
        soliderMove         = new SoliderMove(this);
        soliderReady        = new SoliderReady(this);

        hpMax        = creatureData._hp;
        hp           = hpMax;
        attackSpeed  = creatureData._attackSpeed;
        attackDamage = creatureData._attackDamage;
        defenceType  = creatureData._defenceType;
        attackSkill  = SkillManager.getInstance().AddSkill(1, this);

        attackTime = AnimationCache.getInstance().getAnimation(charName).getMeshAnimation("attack").getAnimTime();
    }
示例#3
0
    public void InitAttr(int _charId)
    {
        D_Creature creatureData = J_Creature.GetData(_charId);

        charName = creatureData._modelName;
        if (charName == null)
        {
            Debug.LogError("MonsterModelName" + _charId + " is NULL");
        }
        SetAttr(CharAttr.HpMax, creatureData._hp);
        SetAttr(CharAttr.HpMaxPer, 0);
        SetAttr(CharAttr.Hp, creatureData._hp);
        SetAttr(CharAttr.HpPer, 0);
        SetAttr(CharAttr.AttackSpeed, creatureData._attackSpeed);
        SetAttr(CharAttr.AttackSpeedPer, 0);
        SetAttr(CharAttr.AttackDamage, creatureData._attackDamage);
        SetAttr(CharAttr.AttackDamagePer, 0);
        SetAttr(CharAttr.ArmorType, creatureData._defenceType);
        SetAttr(CharAttr.Speed, 10);
        SetAttr(CharAttr.SpeedPer, 0);
    }