Пример #1
0
    void KillObject(Collider2D objectToKill)
    {
        RespawnableObject resObject = objectToKill.GetComponent <RespawnableObject>();

        if (!resObject)
        {
            // TODO: Consider destroying these objects?
            objectToKill.gameObject.SetActive(false);
            return;
        }

        resObject.StartRespawn();
    }
Пример #2
0
    void Update()
    {
        xMovement          = Input.GetAxis("Horizontal");
        mouseWorldPosition = mainCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, -mainCamera.transform.position.z));

        if (Input.GetButtonDown("Jump"))
        {
            jump = true;
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            SwapTool();
        }

        if (Input.GetButtonDown("Fire1"))
        {
            if (gameManager.GetPlayerUnlocks().PrimaryFire)
            {
                CurrentTool.OnPrimaryBehaviour();
            }
            else
            {
                textDialogs.ShowDialog(0, false);
            }
        }
        else if (Input.GetButtonDown("Fire2"))
        {
            if (gameManager.GetPlayerUnlocks().SecondaryFire)
            {
                CurrentTool.OnSecondaryBehaviour();
            }
            else
            {
                textDialogs.ShowDialog(1, false);
            };
        }
        else if (Input.GetButtonUp("Fire1"))
        {
            CurrentTool.OnPrimaryReleaseBehaviour();
        }
        else if (Input.GetButtonUp("Fire2"))
        {
            CurrentTool.OnSecondaryReleaseBehaviour();
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            respawn.StartRespawn();
        }
    }