예제 #1
0
    void Start()
    {
        PlayerMovementShop counter    = player.GetComponent <PlayerMovementShop>();
        keyPickup          keyCounter = key.GetComponent <keyPickup>();

        counterTraps   = counter.trap;
        counterPotions = counter.potions;
        counterKeys    = keyCounter.key;
        counterTorches = counter.torches;

        coins = counter.coins;
    }
예제 #2
0
    void Update()
    {
        TorchScript  saveDataTorch = saveTorch.GetComponent <TorchScript>();
        SpeedrunTime timer         = time.GetComponent <SpeedrunTime>();
        keyPickup    keyCounter    = key.GetComponent <keyPickup>();

        textCounterCoins.text = coins.ToString();
        if (chest.isChanged == 0)
        {
            textCounterPotion.text = potions.ToString();
        }
        else if (chest.isChanged == 1 && which.whichOne == 0)
        {
            textCounterPotion.text = potion_mvspeed.ToString();
        }
        else if (chest.isChanged == 1 && which.whichOne == 1)
        {
            textCounterPotion.text = potion_invisible.ToString();
        }
        textCounterTrap.text  = trap.ToString();
        textCounterTorch.text = torches.ToString();
        textCounterKeys.text  = keyCounter.key.ToString();

        movement.x = Input.GetAxisRaw("Horizontal");
        movement.y = Input.GetAxisRaw("Vertical");
        movement   = movement.normalized;
        hf         = movement.x > 0.01f ? movement.x : movement.x < -0.01f ? 1 : 0;
        speed      = movement.y > 0.01f ? movement.y : movement.y < -0.01f ? 1 : 0;
        if (movement.x < -0.01f)
        {
            this.gameObject.transform.localScale = new Vector3(-1, 1, 1);
        }
        else
        {
            this.gameObject.transform.localScale = new Vector3(1, 1, 1);
        }


        anim.SetFloat("Horizontal", hf);
        anim.SetFloat("Vertical", movement.y);
        anim.SetFloat("Speed", speed);
    }
예제 #3
0
    void Update()
    {
        keyPickup keyCounter = key.GetComponent <keyPickup>();

        textCounterCoins.text = coins.ToString();
        if (PlayerPrefs.GetInt("isChanged") == 0)
        {
            textCounterPotion.text = potions.ToString();
        }
        else if (PlayerPrefs.GetInt("whichOne") == 0 && PlayerPrefs.GetInt("isChanged") == 1)
        {
            textCounterPotion.text = potion_mvspeed.ToString();
        }
        else if (PlayerPrefs.GetInt("whichOne") == 1 && PlayerPrefs.GetInt("isChanged") == 1)
        {
            textCounterPotion.text = potion_invisible.ToString();
        }
        textCounterTrap.text  = trap.ToString();
        textCounterTorch.text = torches.ToString();
        textCounterKeys.text  = key.key.ToString();

        movement.x = Input.GetAxisRaw("Horizontal");
        movement.y = Input.GetAxisRaw("Vertical");
        movement   = movement.normalized;
        hf         = movement.x > 0.01f ? movement.x : movement.x < -0.01f ? 1 : 0;
        speed      = movement.y > 0.01f ? movement.y : movement.y < -0.01f ? 1 : 0;
        if (movement.x < -0.01f)
        {
            this.gameObject.transform.localScale = new Vector3(-1, 1, 1);
        }
        else
        {
            this.gameObject.transform.localScale = new Vector3(1, 1, 1);
        }

        anim.SetFloat("Horizontal", hf);
        anim.SetFloat("Vertical", movement.y);
        anim.SetFloat("Speed", speed);
    }