Example #1
0
        //yang 处理土地
        public ISkillTarget GetTerrainTarget(Vector3 normal, Vector3 point)
        {
            IntVector3   fVoxelCenterPos;
            VFVoxel      voxel  = GetRaycastHitVoxel(normal, point, out fVoxelCenterPos);
            ISkillTarget target = new VFTerrainTarget(point, fVoxelCenterPos, ref voxel);

            return(target);
        }
Example #2
0
        //public void RunEff(EffSkillInstance inst, ISkillTarget target)
        //{
        //	// Stand alone and client mine should check target, client proxy should not
        //	if (!GameConfig.IsMultiMode)
        //	{
        //		if (!inst.m_data.CheckTargetsValid(this, target))
        //		{
        //			// TODO : a warning message of not target in scope
        //			return;
        //		}
        //	}

        //	if (GameConfig.IsMultiMode)
        //	{
        //		ESkillTargetType type = target.GetTargetType();
        //		switch (type)
        //		{
        //		case ESkillTargetType.TYPE_SkillRunner:
        //			{
        //				SkillRunner ta = target as SkillRunner;
        //				if (null != ta)
        //					RPC("RPC_C2S_SkillCast", inst.m_data.m_id, ta.OwnerNetworkView.viewID);
        //			}
        //			break;
        //		}
        //	}

        //	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));
        //}

        //public void RunEffOnProxy(EffSkillInstance inst, ISkillTarget target)
        //{
        //	// Stand alone and client mine should check target, client proxy should not
        //	if (!GameConfig.IsMultiMode)
        //	{
        //		if (!inst.m_data.CheckTargetsValid(this, target))
        //		{
        //			// TODO : a warning message of not target in scope
        //			return;
        //		}
        //	}

        //	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));
        //}

        public ISkillTarget GetTargetByGameObject(RaycastHit hitinfo, EffSkillInstance inst)
        {
            ISkillTarget target = null;
            GameObject   obj    = hitinfo.collider.gameObject;

            if (obj != null)
            {
                int layer = obj.layer;
                switch (layer)
                {
                //VFVoxelTerrain
                case 12:
                {
                    //VFVoxelChunkGo chunk;
                    if ((obj.GetComponent <VFVoxelChunkGo>()) != null)
                    {
                        Vector3 fCurPos = hitinfo.point;
                        Vector3 vPos    = fCurPos / VoxelTerrainConstants._scale;

                        vPos += -Vector3.up * 0.01f;

                        IntVector3 fVoxelCenterPos = new IntVector3(Mathf.FloorToInt(vPos.x + 1), Mathf.FloorToInt(vPos.y + 1), Mathf.FloorToInt(vPos.z + 1));

                        VFVoxel voxel = VFVoxelTerrain.self.Voxels.SafeRead(fVoxelCenterPos.x, fVoxelCenterPos.y, fVoxelCenterPos.z);
                        target = new VFTerrainTarget(hitinfo.point, fVoxelCenterPos, ref voxel);
                    }
                }
                break;

                //Player
                case 10:
                {
                    target = obj.GetComponent <SkillRunner>();
                }
                break;
                }
            }

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

            return(target);
        }