Beispiel #1
0
    /// <summary>
    /// Resets player to initial settings
    /// Used when starting a new generation
    /// </summary>
    public void ResetPlayer()
    {
        this.transform.position = initialPos;

        //initialize square with ec data
        maxSteps = ec.GetCurrMaxSteps();

        currStep  = 0;
        currDelay = 0;

        deathByEnemy = false;
        if (!loadedSquare)
        {
            ResetMarkers();
        }

        won = false;
        gameObject.SetActive(true);
    }
Beispiel #2
0
    bool[] reachedMarker; //if a particular marker has been reached, true. Same order and size as goalmarkers

    // Use this for initialization
    void Start()
    {
        rb         = GetComponent <Rigidbody2D>();
        rand       = new System.Random(Guid.NewGuid().GetHashCode());
        initialPos = transform.position;


        ec = GameObject.Find("EvolutionController").GetComponent <EvolutionController>();

        //initialize square with ec data

        maxSteps     = ec.GetCurrMaxSteps();
        mutationRate = ec.GetMutationRate();

        currStep  = 0;
        currDelay = 0;

        //get initial list of movements
        //if not a square loaded from disk
        if (!loadedSquare)
        {
            InitializeMovements();
        }
    }
 // Update is called once per frame
 void Update()
 {
     stepsText.text = "Steps: " + ec.GetCurrMaxSteps();
 }