Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (waypointIndex <= waypoints.Length - 1)
        {
            transform.position = Vector2.MoveTowards(transform.position, waypoints[waypointIndex].position, speed * Time.deltaTime);

            if (transform.position == waypoints[waypointIndex].position)
            {
                waypointIndex++;
            }
        }
        else
        {
            temperature.IncreaseTemperature(Amount);
            Destroy(this.gameObject);
        }


        if (isHealthNotZero)
        {
            if (health <= 0)
            {
                enemyExpressions.SetInteger("State", 2);
                temperature.DecreaseTemperature(Amount);
                sciencePoints.IncreaseSciencePoints(20);
                StartCoroutine(DieOverTime());
                isHealthNotZero = false;
            }
        }
    }
Exemple #2
0
 public void Sell()
 {
     sciencePoints.IncreaseSciencePoints((costOfUpgrade + costOfbuild) / 2);
     GridControls.Instance.mainMap.SetTile(GridControls.Instance.mainMap.WorldToCell(gameObject.transform.position), null);
     Destroy(gameObject);
 }