示例#1
0
        private void UpdateMonsterCurrentBlock(CMapBlocksController target, GameObject parent)
        {
            if (target.blocks.Count == 0)
            {
                return;
            }
            var childCount = parent.transform.childCount;

            for (int i = 0; i < childCount; i++)
            {
                var child      = parent.transform.GetChild(i);
                var objControl = child.GetComponent <CObjectController> ();
                if (objControl != null)
                {
                    var objPosition = child.transform.position;
                    for (int x = 0; x < target.blocks.Count; x++)
                    {
                        var block         = target.blocks [x];
                        var blockPosition = block.transform.position;
                        if (objPosition.x == blockPosition.x &&
                            objPosition.y == blockPosition.y &&
                            objPosition.z == blockPosition.z)
                        {
                            objControl.SetCurrentBlock(block);
                            objControl.SetTargetBlock(block);
                            break;
                        }
                    }
                }
            }
        }
示例#2
0
        private void AddAllChildToList(CMapBlocksController target, GameObject parent)
        {
            var childCount = parent.transform.childCount;

            target.blocks = new System.Collections.Generic.List <CBlockController> ();
            for (int i = 0; i < childCount; i++)
            {
                var child = parent.transform.GetChild(i);
                var block = child.GetComponent <CBlockController> ();
                if (block != null)
                {
                    target.blocks.Add(block);
                }
            }
        }