예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!player)
        {
            player = GameObject.FindWithTag("Player");
            Water  = player.GetComponent <PlayerWater>();
        }



        MaxThirst = Water.MaxWater;
        CurThirst = Water.drink;



        WaterProsent = CurThirst / MaxThirst;
        int WaterProsentint = Mathf.RoundToInt(WaterProsent * 10);

        if (WaterProsentint <= 10)
        {
            for (int i = 0; i < WaterProsentint; i++)
            {
                this.transform.GetChild(i).gameObject.SetActive(true);
            }
            for (int i = 9; WaterProsentint < i + 1; i--)
            {
                this.transform.GetChild(i).gameObject.SetActive(false);
            }
        }

        //transform.localScale = new Vector3(CurThirst / MaxThirst, 1, 0);
    }
예제 #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         Water             = other.GetComponent <PlayerWater>();
         Water.drinkAmount = CurWater;
     }
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     if (GameObject.FindGameObjectWithTag("Player") != null)
     {
         playerWater = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerWater>();
     }
     else
     {
         playerWater = null;
     }
 }
예제 #4
0
    //przelaczanie poruszania sie w wodzie na poruszanie sie na ladzie
    private void poruszanieLad()
    {
        if (playerTransform != null)
        {
            //wylaczanie skryptu odpowiedzialnego za poruszanie po ladzie
            playerControler = playerTransform.GetComponent <PlayerControl>();
            if (playerControler != null)
            {
                playerControler.enabled = true;
            }

            //aktywacja poruszania sie w wodzie
            PlayerWater playerWater = playerTransform.GetComponent <PlayerWater>();
            playerWater.enabled = false;

            playerControler.aktualnaWysokoscSkoku = playerWater.aktualnaWysokoscSkoku;
            //aktualny zwrot kamery - poruszanie sie w wodzie
            playerWater.myszGoraDol = playerControler.myszGoraDol;
        }
    }
예제 #5
0
    private void Start()
    {
        curTarget      = targetPoint[stage];
        startTimeCheck = Time.time;

        if (!collideWithPlayer)
        {
            gameObject.layer = 11;
        }

        CubHolder = GameObject.Find("CubHolder");
        player    = GameObject.Find("Player");
        if (player != null)
        {
            pMovement = player.GetComponent <Movement>();
            pFood     = player.GetComponent <food>();
            pWater    = player.GetComponent <PlayerWater>();
        }


        // Naming = "Delay, AD, Wait, Jump, Walk, Run";

        myBody = this.gameObject.GetComponent <Rigidbody>();
    }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     Water  = player.GetComponent <PlayerWater>();
 }