Beispiel #1
0
    public void Update()
    {
        if (!_canTakeInput.ActivelyTakingInput)
        {
            return;
        }

        DrawScopes();

        if (Input.GetMouseButtonUp(0))
        {
            if (!Character.ProfActivatedGun)
            {
                Manager.Instance.Dialog.ShowDialog(Dialogs.ShouldTalkToProf);
            }
            else
            {
                if (_energy.HalfBatteriesLeft > 2)
                {
                    _energy.AddEnergy(-2);
                    _energy.AddTotalEnergy(-2);

                    ShootCopy();
                }
                else if (_energy.HalfBatteriesLeft == 2)
                {
                    Debug.Log("Special case: Time to die");

                    Manager.Instance.Dialog.ShowDialog(Dialogs.OnlyOneBattery);
                }
                else
                {
                    // Manager.Instance.Dialog.ShowDialog();
                }
            }
        }

        if (Input.GetMouseButtonDown(1))
        {
            _isSucking = true;
        }

        if (Input.GetMouseButtonUp(1))
        {
            _isSucking = false;
        }

        if (_isSucking)
        {
            Suck();
        }
    }
Beispiel #2
0
    private void AbsorbNearbyGuys(CollisionModel collision)
    {
        if (!Input.GetKeyDown(KeyCode.LeftControl) && !Input.GetKeyDown(KeyCode.RightControl))
        {
            return;
        }

        var guys = collision.TouchedObjects
                   .Where(t => t.Object.GetComponent <CanTakeInput>() != null)
                   .ToList();

        foreach (var guy in guys)
        {
            var energy = guy.Object.GetComponent <HasEnergy>();

            // Order here is important
            _energy.AddTotalEnergy(energy.HalfBatteriesTotal);
            _energy.AddEnergy(energy.HalfBatteriesLeft);

            Destroy(guy.Object);
        }
    }