示例#1
0
        private void SpawnBot()
        {
            if (!_isEnabled)
            {
                return;
            }

            var go = Instantiate(_botBasePrefab, _botRoot);

            go.transform.localPosition = Vector3.zero;

            var bot        = go.GetComponent <C_Bot>();
            var partsValid = new Dictionary <ObjectType, PartVersion>()
            {
                { ObjectType.HEAD, (PartVersion)UnityEngine.Random.Range(0, 2) },
                { ObjectType.CHEST, (PartVersion)UnityEngine.Random.Range(0, 2) },
                { ObjectType.LEFT_ARM, (PartVersion)UnityEngine.Random.Range(0, 2) },
                { ObjectType.RIGHT_ARM, (PartVersion)UnityEngine.Random.Range(0, 2) },
                { ObjectType.LEG, (PartVersion)UnityEngine.Random.Range(0, 2) },
            };

            _currentColor = GetColorRandom();
            bot.Init(partsValid, _currentColor);
            _bot = bot;

            bot.OnBotComplete += (s, e) =>
            {
                var layerWaste = LayerMask.NameToLayer("Waste");
                foreach (var box in _boxList.Objects)
                {
                    box.gameObject.layer = layerWaste;
                }

                _isRecyclingStep = true;
                _recyclingText.SetActive(true);
            };

            StartCoroutine(SpawnParachute());
        }
示例#2
0
 private void OnTriggerExit(Collider other)
 {
     CurrentBot = null;
 }
示例#3
0
 private void OnTriggerEnter(Collider other)
 {
     CurrentBot = other.GetComponent <C_Bot>();
 }