예제 #1
0
 // Use this for initialization
 void Start()
 {
     button     = GetComponent <Button>();
     controller = GameObject.Find("SFXController").GetComponent <AudioButtonController>();
     button.onClick.AddListener(delegate { addFX(fx); });
     button.onClick.AddListener(printStuff);
 }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        playerTurn  = true;
        enemy       = Instantiate(enemyType);
        enemyScript = enemy.GetComponent <EnemyController>();
        points      = total_accrued_points;

        enemyAttack       = enemyScript.enemyAttack();
        enemyhealthCanvas = enemy.transform.Find("healthCanvas").gameObject;
        if (enemyhealthCanvas != null)
        {
            enemyHPSlider  = enemyhealthCanvas.transform.Find("Slider").gameObject;
            enemyIntention = enemyhealthCanvas.transform.Find("Intention").gameObject;
            if (enemyHPSlider != null)
            {
                enemyHealthText = enemyHPSlider.transform.Find("Text").gameObject;
            }
            if (enemyIntention != null)
            {
                enemyAttackText = enemyIntention.transform.Find("damage").gameObject;
            }
        }
        //enemyHealthText = enemy.GetComponent<UnityEngine.UI.Slider>().text;

        playerScript = player.GetComponent <PlayerController>();

        attack_text.GetComponent <UnityEngine.UI.Text>().text     = attack.ToString();
        block_text.GetComponent <UnityEngine.UI.Text>().text      = block.ToString();
        healthText.GetComponent <UnityEngine.UI.Text>().text      = playerScript.health.ToString() + "/" + playerScript.maxHealth.ToString();
        enemyHealthText.GetComponent <UnityEngine.UI.Text>().text = enemyScript.health.ToString() + "/" + enemyScript.maxHealth.ToString();

        enemyAttackText.GetComponent <UnityEngine.UI.Text>().text   = enemyAttack.ToString();
        total_points_text.GetComponent <UnityEngine.UI.Text>().text = points.ToString();

        gameScript = game.GetComponent <GameManager>();

        sfx = GameObject.Find("SFXManager").GetComponent <AudioButtonController>();
    }