Skip to content

Lesson "Script" Blueprint

NullPointerExcy edited this page Oct 4, 2024 · 10 revisions

Lesson "Script" Blueprint

For all lessons, the script should look like this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lesson1 : MonoBehaviour
{
    #region Variables defintion
    public ItemCollection itemCollection;
    private WaitForSeconds wait;
    private float gameSpeed = 1;
    #endregion

    /* Your code starts here ... */

    /* Your code ends here ... */

    private void HamsterProperties()
    {
        /* Your code starts here ... */

        /* Your code ends here ... */
    }

    private IEnumerator HamsterMovement()
    {
        #region Variables defintion
        wait = new WaitForSeconds(HamsterGameManager.hamsterGameSpeed);
        yield return new WaitForSeconds(1.5f);

        HamsterProperties();
        Territory.GetInstance().UpdateHamsterPosition();
        yield return wait;
        #endregion

        /* Your code starts here ... */

        /* Your code ends here ... */
    }


    #region Methods
    private void Start()
    {
        gameSpeed = HamsterGameManager.hamsterGameSpeed;
        base.StartCoroutine(HamsterMovement());
    }

    private void Update()
    {
        // Refresh the gamespeed if changed during runtime
        if (gameSpeed != HamsterGameManager.hamsterGameSpeed)
        {
            gameSpeed = HamsterGameManager.hamsterGameSpeed;
            wait = new WaitForSeconds(gameSpeed);
        }
    }
    #endregion
}

The areas /* Your Code starts here ... */ and /* YourCode ends here ... */ are specifically for the participants, where they should write down their solutions.