少年修仙传客户端代码仓库
client_Hale
2019-04-13 015cf97eb566ec42776c0c95bc49fcd0be3d3ee6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class ClientDropItemUtility : Singleton<ClientDropItemUtility>
{
    public void Drop(int[] itemIds)
    {
        var _center = PlayerDatas.Instance.hero.Pos;
        int _count = itemIds.Length;
        int _column = (int)Mathf.Sqrt(_count);
        int _i = 0;
        int _j = 0;
        var _start = _center - Vector3.one * .5f * _column * .5f;
        int _dropCount = 0;
        while (_dropCount < _count)
        {
            var _dropPos = _start + new Vector3(_j * .5f, 0, _i * .5f);
            RaycastHit _hit;
 
            if (!Physics.Raycast(_dropPos + new Vector3(0, 50, 0), Vector3.down, out _hit, 80, LayerUtility.WalkbleMask))
            {
                continue;
            }
 
            DropItem _item = DropItem.Drop(itemIds[_dropCount], _hit.point, CameraController.Instance.CameraObject);
            _dropCount += 1;
            if (_j < _column - 1)
            {
                _j = _j + 1;
            }
            else
            {
                _j = 0;
                _i = _i + 1;
            }
        }
    }
 
    public void Drop(int itemID, Vector3 position)
    {
 
    }
 
    private class ClientDropItem
    {
 
    }
}