예제 #1
0
    void GetTheSupply()
    {
        GunEntity _temp = GameObject.Find("GunEntity").gameObject.GetComponent <GunEntity>();

        _temp.ammo[0] = _temp.ammoMax[0];
        _temp.ammo[1] = _temp.ammoMax[1];
        _temp.ammo[2] = _temp.ammoMax[2];
        GuiGame gui = GameObject.Find("Gui Canvas").gameObject.GetComponent <GuiGame>();

        gui.RefreshGunAmmo();
        supplyPoint.SetActive(false);
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        horizontalAxis = Input.GetAxis("Horizontal");
        verticalAxis   = Input.GetAxis("Vertical");

        Vector2 directionVector = Vector2.zero;

        if (verticalAxis < 0)
        {
            directionVector += Vector2.down;
        }
        else if (verticalAxis > 0)
        {
            directionVector += Vector2.up;
        }

        if (horizontalAxis > 0)
        {
            directionVector += Vector2.right;
        }
        else if (horizontalAxis < 0)
        {
            directionVector += Vector2.left;
        }

        player.movementController.Move(directionVector.normalized);

        pointerWorldPosition = mainCamera.ScreenToWorldPoint(Input.mousePosition);
        reticule.positionController.ChangePosition(pointerWorldPosition);

        player.aimController.Aim(pointerWorldPosition);



        if (Input.GetAxis("Fire1") > 0)
        {
            currentGun = player.CurrentWeapon();
            if (currentGun)
            {
                currentGun.Fire();
            }
        }
    }