예제 #1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        float angle = Mathf.Atan2(cursorPos.y - transform.position.y, cursorPos.x - transform.position.x);

        float angleDegrees = angle * Mathf.Rad2Deg;

        transform.rotation = Quaternion.Euler(0, 0, angleDegrees - 90f);

        if (Input.GetMouseButton(0))
        {
            if (PlayerManager.instance.inventory.CanUse(energyUse * ResearchConsole.calculateBonus(ResearchConsole.UpgradeType.DRILL)))
            {
                activated = true;
                bool mined = CheckMine();
                if (mined)
                {
                    PlayerManager.instance.inventory.LazyCharge(-energyUseBurst * ResearchConsole.calculateBonus(ResearchConsole.UpgradeType.DRILL));
                }
                PlayerManager.instance.inventory.LazyCharge(-energyUse * Time.deltaTime * ResearchConsole.calculateBonus(ResearchConsole.UpgradeType.DRILL));
            }
        }
        else
        {
            activated = false;
        }
    }
    // Update is called once per frame
    void Update()
    {
        Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        float angle = Mathf.Atan2(mousePos.y - transform.position.y, mousePos.x - transform.position.x);

        float angleDegrees = angle * Mathf.Rad2Deg;

        transform.rotation = Quaternion.Euler(0, 0, angleDegrees - 90f);



        //firing
        shotCooldown -= Time.deltaTime;
        if (Input.GetMouseButton(0))
        {
            if (PlayerManager.instance.inventory.CanUse(energyUse * ResearchConsole.calculateBonus(ResearchConsole.UpgradeType.LASER)))
            {
                if (shotCooldown <= 0)
                {
                    Instantiate(projectile, offset.transform.position, transform.rotation);
                    shotCooldown = maxShotCooldown;
                    PlayerManager.instance.inventory.LazyCharge(-energyUse * ResearchConsole.calculateBonus(ResearchConsole.UpgradeType.LASER));
                }
            }
        }
    }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        PlayerManager.instance.inventory.LazyCharge(-passiveEnergyUse * Time.deltaTime);
        Vector3Int location = GameManager.instance.floorMap.WorldToCell(transform.position);

        currentTile = GameManager.instance.floorMap.GetTile(location);

        if (currentTile.name == "Charger")
        {
            PlayerManager.instance.inventory.LazyCharge((4 + (1 + ResearchConsole.calculateBonus(ResearchConsole.UpgradeType.ENERGY))) * Time.deltaTime);
        }
        if (currentTile.name == "Lava")
        {
            PlayerManager.instance.health.Damage(4);
        }
    }
예제 #4
0
    private void FixedUpdate()
    {
        if (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0)
        {
            //battery.charge -= movementEnergyUse * Time.deltaTime;
            PlayerManager.instance.inventory.LazyCharge(-movementEnergyUse * Time.deltaTime * ResearchConsole.calculateBonus(ResearchConsole.UpgradeType.ENERGY));
        }

        if (PlayerManager.instance.inventory.GetTotalCharge() != 0)
        {
            rb.velocity = new Vector3(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")) * speed;
        }
        else
        {
            rb.velocity = new Vector3(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")) * 0.5f;
        }
    }