예제 #1
0
    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 (mState == HookGunState.Null && buttonDown)
        {
            Vector3 shootDir = target.GetPosition() - mGunMuzzle[mCurrentIndex].End.position;
            shootDir.Normalize();
//			if(shootDir.y > 0.17f) // up 10 angle
            {
                mState            = HookGunState.Shooting;
                mTargetPos        = mHook.transform.position;
                mCurrentMoveIndex = 0;
                mShootDir         = (target.GetPosition() - mGunMuzzle[mCurrentIndex].End.position).normalized;
                mOffsetPos        = mSkillRunner.transform.position - mGunMuzzle[mCurrentIndex].End.position;
                List <string> animList = new List <string>();
                animList.Add("HoldOnFire");
                mSkillRunner.ApplyAnim(animList);
                mClimpOffset = 1.5f;
                mHuman.ApplyDurabilityReduce(0);
                AudioManager.instance.Create(transform.position, mFireSound);
                return(true);
            }
        }
        return(false);
    }
예제 #2
0
        // TODO : Confirm how an enemy to attack building
        public EffSkillInstance RunEff(int skillId, ISkillTarget target)
        {
            EffSkillInstance inst = new EffSkillInstance();

            inst.m_data = EffSkill.s_tblEffSkills.Find(iterSkill1 => EffSkill.MatchId(iterSkill1, skillId));
            if (null == inst.m_data)
            {
                // TODO : a warning message of no such skill
                return(null);
            }

            if (null != m_effShareSkillInsts.Find(iterSkill0 => EffSkillInstance.MatchType(iterSkill0, inst.m_data.m_cdInfo.m_type)))
            {
                // TODO : a warning message of another instance of this effskill is still running
                return(null);
            }

            if (null != m_effSkillInsts.Find(iterSkill0 => EffSkillInstance.MatchId(iterSkill0, skillId)))
            {
                // TODO : a warning message of another instance of this effskill is still running
                return(null);
            }
            // TODO : cd info check

            if (!inst.m_data.CheckTargetsValid(this, target))
            {
                // TODO : a warning message of not target in scope
                return(null);
            }

            if (!GameConfig.IsMultiMode || IsController)
            {
                if (GameConfig.IsMultiMode)
                {
                    if (target is CommonInterface)
                    {
                        CommonInterface ta = target as CommonInterface;
                        if (null != ta && null != ta.OwnerView)
                        {
                            RPCServer(EPacketType.PT_InGame_SkillCast, skillId, ta.OwnerView.viewID);
                        }
                        else
                        {
                            RPCServer(EPacketType.PT_InGame_SkillCast, skillId, uLink.NetworkViewID.unassigned);
                        }
                    }
                    else if (target is DefaultPosTarget)
                    {
                        RPCServer(EPacketType.PT_InGame_SkillShoot, skillId, target.GetPosition());
                    }
                    else
                    {
                        RPCServer(EPacketType.PT_InGame_SkillCast, skillId, uLink.NetworkViewID.unassigned);
                    }
                }

                inst.m_timeStartPrep = Time.time;
                inst.m_runner        = new CoroutineStoppable(this, inst.m_data.Exec(this, target, inst));
                inst.m_sharedRunner  = new CoroutineStoppable(this, inst.m_data.SharingCooling(this, inst));
            }
            return(inst);
        }
예제 #3
0
    // 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);
    }