private void InitProgress() { int num = 1; int group = 1; for (int i = 0; i < _info.eventList.Count; ++i) { BaseSkillEvent bse = _info.eventList[i]; if (SKILL_EVENT_TYPE.子弹 == bse.eventType || SKILL_EVENT_TYPE.动作 == bse.eventType) { for (int j = 0; j < bse.times; ++j) { SkillProgress sp = SkillProgressCtrl.Instance.GetSkillProgress(false); _spList.Add(sp); sp.InitEvt(bse, _id, bse.time + bse.interval * j, num, group); ++num; } } else { SkillProgress sp = SkillProgressCtrl.Instance.GetSkillProgress(false); _spList.Add(sp); sp.InitEvt(bse, _id, bse.time, num, group); ++num; } } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } }
public IHttpActionResult PutSkillProgress(int userId, int skillId, int progress) { var skillProgress = db.SkillProgresses.SingleOrDefault(p => p.User.Id == userId && p.Skill.Id == skillId); if (skillProgress == null) { skillProgress = new SkillProgress { SkillId = skillId, UserId = userId, CompletedOn = DateTime.Now, Progress = progress }; db.Entry(skillProgress).State = EntityState.Added; } else { skillProgress.Progress = progress; db.Entry(skillProgress).State = EntityState.Modified; } db.SaveChanges(); return(Ok()); }
public void Begin(Vector3?preBeginPos, Vector3?preBeginDir, Vector3?preEndPos, bool isSync, EntityBase target) { if (_executed == true) { return; } _executed = true; _timer = 0; SkillPreData preData = new SkillPreData(); preData.preBeginPos = preBeginPos; preData.preBeginDir = preBeginDir; preData.preEndPos = preEndPos; SkillCasterData casterData = new SkillCasterData(); casterData.roleId = _caster.roleId; casterData.roleType = CONST_ENTITY_TYPE.MAIN_ROLE; casterData.oriPos = _caster.position; casterData.oriDir = _caster.forward; casterData.oriCenter = _caster.centerPos; SkillTargetData targetData = new SkillTargetData(); if (target != null) { targetData.roleId = target.roleId; targetData.oriPos = target.position; targetData.oriCenter = target.centerPos; } for (int i = 0; i < _spList.Count; ++i) { SkillProgress sp = _spList[i]; sp.SetSkillProgressData(_lv, casterData, preData, targetData, isSync); } Update(0f); }