public IEnumerator DespawnAfterSomeTime(float someTime)
        {
            yield return(new WaitForSeconds(someTime));

            CustomDebug.Log(someTime);
            DestroyAmmunition();
        }
Beispiel #2
0
        public void Execute()
        {
            var h = Input.GetAxis("Horizontal");
            var v = Input.GetAxis("Vertical");

            CustomDebug.Log(h);
            CustomDebug.Log(v);
            _context.MyCharacter.Walk(h, v);
        }
        static void Initialize()
        {
            if (asyncOperationBehaviour == null)
            {
                GameObject g = new GameObject();
                UnityEngine.Object.DontDestroyOnLoad(g);
                g.name = "AsyncOperationExtensionCoroutine";
                //g.hideFlags = HideFlags.HideAndDontSave;
                CustomDebug.Log(1);

                asyncOperationBehaviour = g.AddComponent <AsyncOperationBehaviour>();
            }
        }
        public void Execute()
        {
            var horizontal = Input.GetAxis("Horizontal");
            var vertical   = Input.GetAxis("Vertical");
            var handbreak  = Input.GetAxis("Jump");

            CustomDebug.Log(horizontal);
            CustomDebug.Log(vertical);

            if (!InCar)
            {
                _context.MyCharacter.Walk(horizontal, vertical);
            }
            else
            {
                _context.PlayerCar.Drive(horizontal, vertical, vertical, handbreak);
                _context.MyCharacter.Transform.position = _context.PlayerCar.CarTransform.position;
            }

            if (InCar)
            {
                _context.MyCharacter.Transform.gameObject.SetActive(false);
            }
            else
            {
                _context.MyCharacter.Transform.gameObject.SetActive(true);
            }

            if (Input.GetKeyDown(KeyCode.I))
            {
                if (equipment == null)
                {
                    equipment = _context.CarEquipment;
                }

                equipment.gameObject.SetActive(!equipment.gameObject.activeSelf);
            }

            if (Input.GetKeyDown(KeyCode.E))
            {
                if (Physics.Raycast(_context.MyCharacter.Transform.position, _context.MyCharacter.Transform.forward) && !InCar)
                {
                    InCar = !InCar;
                }
                else if (InCar)
                {
                    InCar = false;
                }
            }
        }