Пример #1
0
    public Skill AddSkill(ResSkill data, bool isCurrent = false)
    {
        Skill skill = null;

        if (data != null)
        {
            if (mSkills.ContainsKey(data.id))
            {
                if (Skill.Create(data, out skill))
                {
                    mSkills[data.id] = skill;
                }
                else
                {
                    return(null);
                }
            }
            else if (Skill.Create(data, out skill))
            {
                mSkills.Add(data.id, skill);
            }

            if (skill != null)
            {
                skill.SetOwner(this);
                if (CurSkill == null || isCurrent)
                {
                    CurSkill = skill;
                }
            }
        }
        return(skill);
    }
Пример #2
0
    protected Skill(ResSkill data)
    {
        Data = data;
        ID   = Data.id;

        Attr = new SkillAttr(Data);
    }
Пример #3
0
    public override void BePickup(ActorObject actor)
    {
        ResSkill data = DataReader <ResSkill> .Get(SkillId);

        if (data == null)
        {
            return;
        }
        switch ((Skill.ESkillType)data.type)
        {
        case Skill.ESkillType.Bullet:
            GamingSys.Instance.Player.Bullet += data.bullet;
            break;

        case Skill.ESkillType.Food:
            GamingSys.Instance.Player.Food += data.food;
            break;

        case Skill.ESkillType.HpPack:
            GamingSys.Instance.Player.AddHp(data.hp);
            break;

        default:
            actor.Attr.Add(new SkillAttr(data));
            break;
        }
        LeaveScene();
    }
Пример #4
0
 public ActorAttr(ResSkill data)
 {
     mExp       = new Formula <long>(0);
     mHp        = new Formula <int>(data.hp);
     mHpLmt     = new Formula <int>(data.hp_lmt);
     mMoveSpeed = new Formula <float>(data.sub_speed);
     mAtk       = new Formula <int>(data.attack);
     mDefence   = new Formula <int>(data.defence);
 }
Пример #5
0
 public SkillAttr(ResSkill data) : base(data)
 {
     mAttackDist  = new Formula <float>(data.attack_dist);
     mAtkDuration = new Formula <int>(data.attack_duration);
     mFindDist    = new Formula <float>(data.find_dist);
     mLostDist    = new Formula <float>(data.lose_dist);
     mBullet      = new Formula <int>(data.bullet);
     mFood        = new Formula <int>(data.food);
     mHitRatio    = new Formula <int>(data.hit_ratio);
     mDodgeRatio  = new Formula <int>(data.dodge_ratio);
     mCritRatio   = new Formula <int>(data.crit_ratio);
     mDecritRatio = new Formula <int>(data.decrit_ratio);
 }
Пример #6
0
    public void AddItem(ItemObject newItem)
    {
        ResSkill skillData = DataReader <ResSkill> .Get(newItem.SkillId);

        if (skillData == null)
        {
            return;
        }

        ItemObject oldItem = null;

        if (mPack.TryGetValue(skillData.kind, out oldItem))
        {
            //品质好过背包
            if (mSkills[oldItem.SkillId].Data.level < skillData.level)
            {
                GiveUpItem(oldItem);//扔掉背包里的武器
            }
            else
            {
                return;
            }
        }

        //拾取地上的武器
        mPack[skillData.kind] = newItem;
        PickUpItem(newItem);
        FirePoint = newItem.transform.GetComponent <PointHandle>().firePoint;
        if (skillData.kind == GamingSys.Instance.Player.WeaponKind)
        {
            newItem.gameObject.SetActive(true);
            AddSkill(skillData, true);//添加技能
        }
        else
        {
            newItem.gameObject.SetActive(false);
            AddSkill(skillData, false);//添加技能
        }
    }
Пример #7
0
    public static bool Create(ResSkill data, out Skill skill)
    {
        if (data != null)
        {
            switch ((ESkillType)data.type)
            {
            case ESkillType.Fist:
            case ESkillType.Cold:
                skill = new Weapon(data);
                return(true);

            case ESkillType.Pistol:
            case ESkillType.Rifle:
                skill = new Gun(data);
                return(true);

            case ESkillType.Heal:
                skill = new Buff(data);
                return(true);
            }
        }
        skill = null;
        return(false);
    }
Пример #8
0
 public Weapon(ResSkill data) : base(data)
 {
 }
Пример #9
0
 public Supplies(ResSkill data) : base(data)
 {
 }
Пример #10
0
 public Armor(ResSkill data) : base(data)
 {
 }
Пример #11
0
 public Buff(ResSkill data) : base(data)
 {
     _cd = Attr.AtkDuration / 1000f;
 }
Пример #12
0
 public Gun(ResSkill data) : base(data)
 {
 }