void OnGUI()
 {
     // This one will show the number of apple seeds the player have collected
     if (GUIScript.GetGameOn() == true)
     {
         GUI.Label(new Rect(40, 80, 200, 100), "<size=40>" + Lars.GetPoints() + "</size>");
     }
     if (GUI.Button(new Rect(10, 10, 100, 50), "Quit"))
     {
         Application.Quit();
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (Lars.GetHeroHP() <= 0)           // if lars's has no more HP the health will be destroyed
        {
            Destroy(gameObject);
        }

        DistanceX = Lars.GetLarsX();
        DistanceZ = Lars.GetLarsZ();

        transform.position   = new Vector3(DistanceX, 3f, DistanceZ);           // the heath bar is following lars
        transform.localScale = new Vector3(Lars.GetHeroHP() / 60F, 0.2F, 0.2F); // the health bar is scaled on the x axis according to lars's HP
    }
    // Update is called once per frame
    void Update()
    {
        if (GUIScript.GetGameOn() == true)
        {
            AppleSeed.enabled = true;                   // When the game starts will the apple seed image be shown
        }

        if (Lars.GetHeroHP() <= 0)
        {
            Lose.enabled = true;                // If Lars's HP gets to 0 or below will the lose screen pop up
        }
        else if (tree.GetBossHP() <= 0)
        {
            Win.enabled = true;                         // If the Tree's HP gets to 0 or below will the win screen pop up
        }
    }
Пример #4
0
 public static ZCodeSearchResultItemModel FromLars(Lars lars)
 {
     return(new ZCodeSearchResultItemModel
     {
         LearnAimRef = lars.LearnAimRef,
         LearnAimRefTitle = lars.LearnAimRefTitle,
         NotionalNVQLevelv2 = lars.NotionalNVQLevelv2,
         AwardOrgCode = lars.AwardOrgCode,
         LearnDirectClassSystemCode1 = lars.LearnDirectClassSystemCode1,
         LearnDirectClassSystemCode2 = lars.LearnDirectClassSystemCode2,
         GuidedLearningHours = lars.GuidedLearningHours,
         TotalQualificationTime = lars.TotalQualificationTime,
         UnitType = lars.UnitType,
         AwardOrgName = lars.AwardOrgName,
         LearnAimRefTypeDesc = lars.LearnAimRefTypeDesc
     });
 }
    //This is the default Update() script - !!!
    public void AppleScriptUpdate()
    {
        //Look at lars
        this.transform.LookAt(GameObject.Find("Lars").transform);         // the apples will always look at lars


        if (GUIScript.GetGameOn() == true)
        {
            DistanceX = Mathf.Abs(transform.position.x) - Mathf.Abs(Lars.GetLarsX());                   // Calculates the distance on the x-axies of Lars and the apple by using the abselute value
            DistanceZ = Mathf.Abs(transform.position.z) - Mathf.Abs(Lars.GetLarsZ());                   // Calculates the distance on the z-axies of Lars and the apple by using the abselute value

            // A range detector had to be made or the apples would always move
            if (Mathf.Abs(DistanceX - DistanceZ) <= 5.0f)               // If the abselute value of the sum of Distance X and Z is smaller then 5 then:
            {
                InRange = true;                                         // Lars is close enough and the apple should move towards him
            }
            else
            {
                InRange = false;                                                                // Lars is too far away and the apple shall stand still.
            }
            if (InRange == true)
            {
                if (DistanceX <= 5.0f && DistanceX >= 0.0f)                             // If Lars is standing far enough to the left then:
                {
                    transform.position += new Vector3(-Speed, 0, 0) * Time.deltaTime;   // Move the apple towards the left
                }
                else if (DistanceX <= 0.0f && DistanceX >= -5.0f)                       // If Lars is standing far enough to the right then:
                {
                    transform.position += new Vector3(Speed, 0, 0) * Time.deltaTime;    // Move the apple towards the right
                }

                if (DistanceZ <= 5.0f && DistanceZ >= 0.0f)                             // If Lars is standing far enough to the up then:
                {
                    transform.position += new Vector3(0, 0, -Speed) * Time.deltaTime;   // Move the apple towards the up
                }
                else if (DistanceZ <= 0.0f && DistanceZ >= -5.0f)                       // If Lars is standing far enough to the down then:
                {
                    transform.position += new Vector3(0, 0, Speed) * Time.deltaTime;    // Move the apple towards the down
                }
            }
        }
    }
    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.name == "BallOfFire(Clone)")
        {
            GetHit(BallOfFire.GetBallDmg());                    // When the Ball of Fire hits an apple it will get hit with the ball's damage
            print(AppleGREEN.GetHP() + " " + AppleRed.GetHP() + " " + AppleYELLOW.GetHP() + " " + Lars.GetHeroHP());
        }

        if (other.gameObject.name == "Lars")
        {
            for (float i = 0f; i < 5f; i += 0.1f)               //making the Apple jump y=5 up sort of slowly when touched by lars, giving him time to get away
            {
                transform.position += new Vector3(0, i, 0) * Time.deltaTime;
            }
        }
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        if (GUIScript.GetGameOn() == true)
        {
            valueX = Mathf.Abs(Lars.GetLarsX() - transform.position.x);              // x-axis distance from the tree and lars
            valueZ = Mathf.Abs(Lars.GetLarsZ() - transform.position.z);              // z-axis distance from the tree and lars

            if (ATKready == true)
            {
                if (valueX < 2.0f && valueZ < 2.0f)
                {
                    LarsOldX = Lars.GetLarsX();                     // saves lars's current position
                    LarsOldZ = Lars.GetLarsZ();
                    Invoke("damageFunction", 2);                    // will activate the damage function after 2 sec.
                    ATKready = false;
                }
                else if (valueX < 4.0f && valueZ < 4.0f)
                {
                    LarsOldX = Lars.GetLarsX();                     // saves lars's current position
                    LarsOldZ = Lars.GetLarsZ();
                    Invoke("damageFunction", 3);                    // will activate the damage function after 3 sec.
                    ATKready = false;
                }
                else if (valueX < 6.0f && valueZ < 6.0f)
                {
                    LarsOldX = Lars.GetLarsX();                     // saves lars's current position
                    LarsOldZ = Lars.GetLarsZ();
                    Invoke("damageFunction", 4);                    // will activate the damage function after 4 sec.
                    ATKready = false;
                }
                else if (valueX < 8.0f && valueZ < 8.0f)
                {
                    LarsOldX = Lars.GetLarsX();                     // saves lars's current position
                    LarsOldZ = Lars.GetLarsZ();
                    Invoke("damageFunction", 5);                    // will activate the damage function after 5 sec.
                    ATKready = false;
                }
                else if (valueX < 10.0f && valueZ < 10.0f)
                {
                    LarsOldX = Lars.GetLarsX();                     // saves lars's current position
                    LarsOldZ = Lars.GetLarsZ();
                    Invoke("damageFunction", 6);                    // will activate the damage function after 6 sec.
                    ATKready = false;
                }
            }

            if (BossHP <= 0)              // if the tree boss has no mor HP he will be destoyed
            {
                Destroy(gameObject);
            }

            // This code will set a small timer on 2 seconds or the attack would be very buggy
            if (ATKready == false)
            {
                ATKtimer++;
                if (ATKtimer == 12)
                {
                    ATKready = true;
                    ATKtimer = 0;
                }
            }
        }
    }