Пример #1
0
    // Use this for initialization
    void Start()
    {
        //Vector3 start = new Vector3(0, 0, Camera.main.nearClipPlane);
        //Vector3 end = new Vector3(Screen.width, 0, Camera.main.nearClipPlane);
        //screenWidth = (Camera.main.ScreenToWorldPoint(end) - Camera.main.ScreenToWorldPoint(start)).magnitude;
        print("Screen Width: " + screenWidth);
        enemiesLayer  = GameObject.Find("Enemies").transform;
        startPosition = hero.transform.position.x;

        heroAttack  = hero.GetComponent <StriderAttack>();
        heroControl = hero.GetComponent <StriderControl>();

        GUIKillCount      = transform.Find("InGameUI/KillCount/KillNumber").gameObject.GetComponent <Text>();
        GUIKillCount.text = killCount.ToString();
        GUIDistance       = transform.Find("InGameUI/DistanceCount/DistanceNumber").gameObject.GetComponent <Text>();
        GUIDistance.text  = distanceTravelled.ToString();
        GUIExpBar         = transform.Find("ExpCanvas/ExpUI/ExpBar").gameObject.GetComponent <Slider>();
        GUISkillPt        = transform.Find("ExpCanvas/ExpUI/SkillsUI/SkillPoints").gameObject.GetComponent <Text>();
        GUIAddAttack      = transform.Find("ExpCanvas/ExpUI/SkillsUI/AddAttack").gameObject.GetComponent <Button>();
        GUIAddSpeed       = transform.Find("ExpCanvas/ExpUI/SkillsUI/AddSpeed").gameObject.GetComponent <Button>();
        GUILives          = transform.Find("ExpCanvas/ExpUI/Lives").gameObject.GetComponent <Text>();
        GUIInstruction    = transform.Find("Instruction/Instruction1").gameObject.GetComponent <Text>();

        GUISkillPt.text    = "Skill Points: " + skillPoints;
        GUIExpBar.maxValue = nextExp;
        GUIExpBar.value    = exp;

        lives = startingLives;

        StartCoroutine(destroyInstruction());
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     rigidBody2D = GetComponent <Rigidbody2D>();
     animator    = GetComponent <Animator>();
     attack      = GetComponent <StriderAttack>();
 }
 public void SetAttackControl(StriderAttack striderAttack)
 {
     this.attackControl = striderAttack;
 }