Example #1
0
 //Show expanded info for a result
 public void ToDetails(int ind)
 {
     //Originally I tried using this: int ind = this.GetComponentInChildren<NumHolder>().index;
     //But that always got the index of the first button, so I created SendToDetails() in NumHolder
     Text[] details = DetailsUI.GetComponentsInChildren <Text>();
     details[0].text   = "Title: " + ProgramList[ind].Title;
     details[1].text   = "Description: " + ProgramList[ind].Description;
     details[2].text   = "Subject: " + ProgramList[ind].Subject;
     details[3].text   = "Country of Origin: " + ProgramList[ind].CountryOfOrigin;
     details[4].text   = "Media Type: " + ProgramList[ind].MediaType;
     details[5].text   = "Duration: " + ProgramList[ind].Duration;
     ResultsUI.enabled = false;
     DetailsUI.enabled = true;
 }
Example #2
0
    void Update()
    {
        actionBar = FindObjectOfType <ActionBar>();
        detailsUI = FindObjectOfType <DetailsUI>();


        if (thrown == true)
        {
            pickUp();
        }


        if (Input.GetMouseButton(1) && actionBar.UIStatus != 0 && throwRdy == false) //Charges spear
        {
            charging = true;

            if (!throwRdy)
            {
                anim.Play("spearThrow");
            }
        }

        if (Input.GetMouseButtonUp(1) && thrown == false && throwRdy == true)
        {
            charging = false;
            throwRdy = false;

            anim.speed = 1;
        }


        if (Input.GetMouseButton(0) && actionBar.UIStatus != 0 && throwRdy == false)
        {
            attackAnimPlaying = true;
            //whoosh.pitch = Random.Range(0.8f, 1.2f);
            //whoosh.Play(); // SOUND EFFECT

            anim.Play("spearAttack"); // ANIMATION


            this.GetComponent <Collider>().enabled = true;
        }
        else
        {
            if (thrown == true)
            {
                this.GetComponent <Collider>().enabled = true;
            }
            else
            {
                this.GetComponent <Collider>().enabled = false;
                attackAnimPlaying = false;
            }

            if (Input.GetMouseButtonUp(0))
            {
                attackAnimPlaying = false;
            }



            if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D) && actionBar.UIStatus != 0)
            {
                if (!throwRdy && attackAnimPlaying == false && charging == false)
                {
                    anim.Play("spearWalk");
                }
            }
        }
    }