Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     NextHostageDisplay.Find("Text").GetComponent <Text>().text                = currentHostage.name;
     NextHostageDisplay.Find("Image").GetComponent <Image>().sprite            = currentHostage.getSprite();
     hostageInfoDisplay.transform.Find("Name").GetComponent <Text>().text      = currentHostage.name;
     hostageInfoDisplay.transform.Find("Image").GetComponent <Image>().sprite  = currentHostage.getSprite();
     hostageInfoDisplay.transform.Find("Backstory").GetComponent <Text>().text = currentHostage.background;
     hostageInfoDisplay.transform.Find("Mass").GetComponent <Text>().text      = "Mass: " + currentHostage.mass.ToString();
     hostageInfoDisplay.transform.Find("Slip").GetComponent <Text>().text      = "Slip: " + ((1 - currentHostage.friction) * 10).ToString();
     for (int i = 0; i < hostageInfoDisplay.transform.Find("HP").childCount; i++)
     {
         bool active = int.Parse(hostageInfoDisplay.transform.Find("HP").GetChild(i).name) <= currentHostage.hp;
         hostageInfoDisplay.transform.Find("HP").GetChild(i).gameObject.SetActive(active);
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         OpenPauseMenu(!pauseMenu.activeSelf);
     }
 }
Exemple #2
0
 public void UnlockNewHostage(Hostage hostage)
 {
     CloseHostageDisplay();
     unlockInfoDisplay.transform.Find("Name").GetComponent <Text>().text      = hostage.name;
     unlockInfoDisplay.transform.Find("Image").GetComponent <Image>().sprite  = hostage.getSprite();
     unlockInfoDisplay.transform.Find("Backstory").GetComponent <Text>().text = hostage.background;
     Collectables.UnlockedHostages.Add(hostage);
     Collectables.SaveCollectables();
     UnpauseGame(false);
     unlockInfoDisplay.SetActive(true);
 }
    IEnumerator Release()
    {
        GetComponent <SpriteRenderer>().sprite = hostage.getSprite();
        yield return(new WaitForSeconds(releaseTime * 0.15f));

        rb.freezeRotation = false;
        gameObject.layer  = 2;
        rb.isKinematic    = false;
        GetComponent <SpringJoint2D>().enabled = false;
        rb.AddForce((player.transform.position - transform.position).normalized * power * -1 * (hostage.mass / 2));
        GameObject.FindObjectOfType <PlayerManager>().hasHostage = false;
    }
    void DisplayHostage(Hostage hostage)
    {
        Transform info = transform.Find("Info");

        info.Find("Name").GetComponent <Text>().text           = hostage.name;
        info.Find("Image").GetComponent <Image>().sprite       = hostage.getSprite();
        info.Find("Backstory").GetComponent <Text>().text      = hostage.background;
        info.transform.Find("Mass").GetComponent <Text>().text = "Mass: " + hostage.mass.ToString();
        info.transform.Find("Slip").GetComponent <Text>().text = "Slip: " + ((1 - hostage.friction) * 10).ToString();
        for (int i = 0; i < info.transform.Find("HP").childCount; i++)
        {
            bool active = int.Parse(info.transform.Find("HP").GetChild(i).name) <= hostage.hp;
            info.transform.Find("HP").GetChild(i).gameObject.SetActive(active);
        }
        info.gameObject.SetActive(true);
    }