Esempio n. 1
0
    private void ProcDigB45s(SkEntity caster)
    {
        SkInst      inst       = SkRuntimeInfo.Current as SkInst;
        IDigTerrain digTerrain = caster as IDigTerrain;
        IntVector4  digPos     = null;

        if (null == digTerrain || (digPos = digTerrain.digPosType) == IntVector4.Zero || (inst != null && !(inst._target is Block45Man)))
        {
            return;
        }

        float damage = caster.GetAttribute((int)AttribType.Atk);
        float radius = caster.GetAttribute((int)AttribType.ResRange);
        float height = caster.GetAttribute((int)AttribType.ResRange);
        //		float resourceBonus = caster.GetAttribute((int)AttribType.ResBouns);
        //		bool returnResource = digPos.w == 1;

        PeEntity entity = caster != null?caster.GetComponent <PeEntity>() : null;

        if (entity != null && entity.monster != null)
        {
            radius = entity.bounds.extents.x + 1;
            height = entity.bounds.extents.y + 1;
        }

        if (null != inst && null != inst._colInfo)
        {
            int effecID = 0;
            if (radius < 3)
            {
                effecID = 258;
            }
            else if (radius < 5f)
            {
                effecID = 259;
            }
            else
            {
                effecID = 260;
            }
            Pathea.Effect.EffectBuilder.Instance.Register(effecID, null, inst._colInfo.hitPos, Quaternion.identity);
        }

        if (!GameConfig.IsMultiMode)
        {
            List <B45Block> removeList = new List <B45Block>();
            DigTerrainManager.DigBlock45(digPos.ToIntVector3(), damage * 0.2f, radius, height, ref removeList, false);
        }
        else
        {
            /// TODO : code for multiplayer
        }
    }
Esempio n. 2
0
    IEnumerator NpcRevive(SkEntity entity, float delayTime)
    {
        if (Pathea.PeGameMgr.IsMulti)
        {
            yield break;
        }

        PeEntity peentity = entity.GetComponent <PeEntity>();

        if (peentity == null)
        {
            yield break;
        }

        EntityInfoCmpt InfoCmpt = peentity.enityInfoCmpt;

        InfoCmpt.SetDelaytime(Time.time, delayTime);

        PESkEntity skentity = peentity.peSkEntity;

        yield return(new WaitForSeconds(delayTime));

        if (entity != null && skentity != null && skentity.isDead)
        {
            MotionMgrCmpt motion = entity.GetComponent <MotionMgrCmpt>();
            if (motion != null)
            {
                while (true)
                {
                    if (null == peentity || null == motion)
                    {
                        yield break;
                    }
                    //在复活中被任务设置成不能复活 ReviveTime = -1
                    if (peentity.NpcCmpt.ReviveTime < 0)
                    {
                        break;
                    }

                    PEActionParamB param = PEActionParamB.param;
                    param.b = false;
                    if (motion.DoAction(PEActionType.Revive, param))
                    {
                        entity.SetAttribute((int)AttribType.Hp, entity.GetAttribute((int)AttribType.HpMax) * 0.8f);
                        break;
                    }
                    else
                    {
                        yield return(new WaitForSeconds(1));
                    }
                }
            }
        }
    }
Esempio n. 3
0
        public virtual void SetData(ProjectileData data, Transform caster, Transform emitter, Transform target, Vector3 targetPosition, int index = 0)
        {
            //m_Data = data;
            m_Caster         = caster;
            m_Emitter        = emitter;
            m_Target         = target;
            m_TargetPosition = targetPosition;

            m_Valid = true;

            float    atk      = 0.0f;
            SkEntity skCaster = m_Caster.GetComponentInParent <SkEntity>();

            if (skCaster != null)
            {
                SetNet(skCaster._net, false);
                atk = skCaster.GetAttribute((int)AttribType.Atk);
            }

            parentSkEntity = skCaster;
            SkProjectile skPro = skCaster as SkProjectile;

            if (skPro != null)
            {
                parentSkEntity = skPro.GetSkEntityCaster();
                if (parentSkEntity != null)
                {
                    m_Caster = parentSkEntity.transform;
                }
            }

            SetAttribute((int)AttribType.Atk, m_Atk + atk);

            if (m_Trajectory != null)
            {
                m_Trajectory.SetData(m_Caster, m_Emitter, m_Target, m_TargetPosition, index);
            }

            if (null != m_Emitter && !m_Explode)
            {
                CheckInTrigger(m_Emitter.position);
            }
        }
    private void ProcDigVoxels(SkEntity caster)
    {
        SkInst      inst       = SkRuntimeInfo.Current as SkInst;
        IDigTerrain digTerrain = caster as IDigTerrain;
        IntVector4  digPos     = null;

        if (null == digTerrain || (digPos = digTerrain.digPosType) == IntVector4.Zero || (inst != null && !(inst._target is VFVoxelTerrain)))
        {
            return;
        }

        float      damage         = caster.GetAttribute((int)AttribType.Atk) * (1f + caster.GetAttribute((int)AttribType.ResDamage));
        float      radius         = caster.GetAttribute((int)AttribType.ResRange);
        float      resourceBonus  = caster.GetAttribute((int)AttribType.ResBouns);
        float      height         = caster.GetAttribute((int)AttribType.ResDamage);
        bool       returnResource = digPos.w == 1;
        IntVector3 intPos         = digPos.XYZ;

        if (!GameConfig.IsMultiMode)
        {
            //VFVoxel getVoxel = VFVoxelTerrain.self.Voxels.SafeRead(intPos.x, intPos.y, intPos.z);
            List <VFVoxel> removeList = new List <VFVoxel>();
            DigTerrainManager.DigTerrain(intPos,
                                         damage * (returnResource ? 5f : 1f),
                                         radius,
                                         height,
                                         ref removeList, returnResource);
            if (returnResource)
            {
                bool bGetSpItems = false;
                if (caster is SkAliveEntity)
                {
                    SkAliveEntity    alive = (SkAliveEntity)caster;
                    SkillTreeUnitMgr mgr   = alive.Entity.GetCmpt <SkillTreeUnitMgr>();
                    bGetSpItems = mgr.CheckMinerGetRare();
                }
                Dictionary <int, int> itemGet = DigTerrainManager.GetResouce(removeList, resourceBonus, bGetSpItems);
                if (itemGet.Count > 0)
                {
                    List <int> itemsArray = new List <int>(itemGet.Count * 2);
                    foreach (int intemID in itemGet.Keys)
                    {
                        itemsArray.Add(intemID);
                        itemsArray.Add(itemGet[intemID]);
                    }
                    caster.Pack += itemsArray.ToArray();
                }
            }
        }
        else
        {
            if (caster != null && caster._net != null)
            {
                //VFVoxel getVoxel = VFVoxelTerrain.self.Voxels.SafeRead(intPos.x,intPos.y, intPos.z);

                bool bGetSpItems = false;
                if (returnResource)
                {
                    if (caster is SkAliveEntity)
                    {
                        SkAliveEntity    alive = (SkAliveEntity)caster;
                        SkillTreeUnitMgr mgr   = alive.Entity.GetCmpt <SkillTreeUnitMgr>();
                        bGetSpItems = mgr.CheckMinerGetRare();
                    }
                }

                DigTerrainManager.DigTerrainNetwork((SkNetworkInterface)(caster._net), intPos, damage * (returnResource ? 5f : 1f),
                                                    radius, resourceBonus, returnResource, bGetSpItems, 0.3f);
            }
        }
    }
Esempio n. 5
0
 public float GetAttribute(AttribType type, bool bSum = true)
 {
     return(m_SkEntity != null?m_SkEntity.GetAttribute((int)type, bSum) : 0.0f);
 }