public override bool CostSkill(ISkillTarget target, int sex = 2, bool buttonDown = false, bool buttonPressed = false) { if (buttonDown) { if (mSkillMaleId.Count == 0 || mSkillFemaleId.Count == 0) { return(false); } EffSkillInstance skillInstance = null; switch (sex) { case 1: skillInstance = CostSkill(mSkillRunner, mSkillFemaleId[0], target); break; case 2: skillInstance = CostSkill(mSkillRunner, mSkillMaleId[0], target); break; } if (null != skillInstance) { mHuman.ApplyAmmoCost(EArmType.Bomb, mItemObj.instanceId); } return(null != skillInstance); } return(false); }
public override bool CostSkill(SkillAsset.ISkillTarget target = null, int sex = 2, bool buttonDown = false, bool buttonPressed = false) { if (!base.CostSkill(target, sex, buttonDown, buttonPressed)) { return(false); } if (mSkillMaleId.Count == 0 || mSkillFemaleId.Count == 0) { return(false); } int castSkillId = 0; switch (sex) { case 1: castSkillId = mSkillFemaleId[0]; for (int i = 0; i < mSkillFemaleId.Count - 1; i++) { if (mSkillRunner.IsEffRunning(mSkillFemaleId[i])) { castSkillId = mSkillFemaleId[i + 1]; } } break; case 2: castSkillId = mSkillMaleId[0]; for (int i = 0; i < mSkillMaleId.Count - 1; i++) { if (mSkillRunner.IsEffRunning(mSkillMaleId[i])) { castSkillId = mSkillMaleId[i + 1]; } } break; } EffSkillInstance inst = CostSkill(mSkillRunner, castSkillId, target); if (inst != null) { lastFireTime = Time.time; PlayMuzzleEffect(); } return(inst != null); }
public override bool CostSkill(ISkillTarget target, int sex = 2, bool buttonDown = false, bool buttonPressed = false) { if (mMainPlayerEquipment) { mUnActiveTime = 0.5f; mOpCube.Active = true; } if (mSkillMaleId.Count == 0 || mSkillFemaleId.Count == 0) { return(false); } if (!base.CostSkill(target, sex, buttonDown, buttonPressed)) { return(false); } if (mOpCube.Active && mOpCube.Enable) { int castSkillId = 0; switch (sex) { case 1: castSkillId = mSkillFemaleId[0]; break; case 2: castSkillId = mSkillMaleId[0]; break; } EffSkillInstance skillInstance = mSkillRunner.GetRunningEff(castSkillId); if (null != skillInstance && buttonPressed) { skillInstance.mSkillCostTimeAdd = true; skillInstance.mNextTarget = mTarget; } else if (null == skillInstance && buttonDown) { skillInstance = CostSkill(mSkillRunner, castSkillId, mTarget); } return(null != skillInstance); } return(false); }
public override bool CostSkill(ISkillTarget target, int sex = 2, bool buttonDown = false, bool buttonPressed = false) { if (!base.CostSkill(target, sex, buttonDown, buttonPressed)) { return(false); } if (mShootState == ShootState.Aim || mShootState == ShootState.Fire) { for (int i = 0; i < mGunMuzzle.Count; i++) { int idx = (i + mCurrentIndex + 1) % mGunMuzzle.Count; if ((mGunMuzzle[idx].Multishot && Time.time - mCoolDownTime[idx] > mGunMuzzle[idx].FireInterval && (buttonDown || buttonPressed)) || (!mGunMuzzle[idx].Multishot && buttonDown)) { if (mHuman.CheckAmmoCost(mGunMuzzle[idx].ArmType, mGunMuzzle[idx].CostItemId)) { mCurrentIndex = idx; Transform muzzle = mGunMuzzle[mCurrentIndex].End; float base_acc = 0.5f; if (mGunMuzzle[mCurrentIndex] != null) { base_acc = mGunMuzzle[mCurrentIndex].Accuracy; } float accuracy = mRuntimeAccuracyScale * base_acc; float xErr = (Random.value - 0.5f) * 1.8f * accuracy; float yErr = (Random.value - 0.5f) * 1.8f * accuracy; muzzle.localEulerAngles = new Vector3(xErr, yErr, 0); EffSkillInstance skillInstance = CostSkill(mSkillRunner, mGunMuzzle[idx].SkillId, target); if (null != skillInstance) { mHuman.ApplyDurabilityReduce(0); mCoolDownTime[idx] = Time.time; mGunMuzzle[idx].PlayMuzzleEffect(); mHuman.ApplyAmmoCost(mGunMuzzle[idx].ArmType, mGunMuzzle[idx].CostItemId); return(true); } } } } } return(false); }
public override bool CostSkill(ISkillTarget target, int sex = 2, bool buttonDown = false, bool buttonPressed = false) { if (!base.CostSkill(target, sex, buttonDown, buttonPressed)) { return(false); } if (buttonDown && mShootState == ShootState.Aim) { if (mHuman.CheckAmmoCost(EArmType.Ammo, mArrowId)) { if (mSkillMaleId.Count == 0 || mSkillFemaleId.Count == 0) { return(false); } EffSkillInstance skillInstance = null; switch (sex) { case 1: skillInstance = CostSkill(mSkillRunner, mSkillFemaleId[0], target); break; case 2: skillInstance = CostSkill(mSkillRunner, mSkillMaleId[0], target); break; } if (null != skillInstance) { mHuman.ApplyDurabilityReduce(0); mHuman.ApplyAmmoCost(EArmType.Ammo, mArrowId); _Animator.SetBool("Fire", true); mShootState = ShootState.Fire; return(true); } } } return(false); }
// Use this for initialization public virtual bool CostSkill(ISkillTarget target = null, int sex = 2, bool buttonDown = false, bool buttonPressed = false) { LifeLimit si = mItemObj.GetCmpt <LifeLimit>(); if (null == si) { return(false); } if (si.lifePoint.current < PETools.PEMath.Epsilon) { return(false); } if (mSkillMaleId.Count == 0 || mSkillFemaleId.Count == 0) { return(false); } //if(mItemObj.GetProperty(ItemProperty.Durability) < PETools.PEMath.Epsilon) // return false; mCastSkillId = 0; switch (sex) { case 1: mCastSkillId = mSkillFemaleId[0]; mSkillIndex = 0; for (int i = 0; i < mSkillFemaleId.Count - 1; i++) { if (mSkillRunner.IsEffRunning(mSkillFemaleId[i])) { mCastSkillId = mSkillFemaleId[i + 1]; mSkillIndex = i + 1; } } break; case 2: mCastSkillId = mSkillMaleId[0]; mSkillIndex = 0; for (int i = 0; i < mSkillMaleId.Count - 1; i++) { if (mSkillRunner.IsEffRunning(mSkillMaleId[i])) { mCastSkillId = mSkillMaleId[i + 1]; mSkillIndex = i + 1; } } break; } EffSkillInstance skillInstance = CostSkill(mSkillRunner, mCastSkillId, target); if (null != mSkillRunner && null != target && null != skillInstance && mSkillRunner != target) { Vector3 dir = target.GetPosition() - mSkillRunner.transform.position; mSkillRunner.transform.LookAt(mSkillRunner.transform.position + dir, Vector3.up); } return(null != skillInstance); }