예제 #1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if ((activeButton == ButtonState.fire || activeButton == ButtonState.remove) && Physics.Raycast(ray, out hit, 1000, stats.plantMask))
            {
                clickedPlant = hit.collider.gameObject.GetComponent <Plant>();
                MouseActionOnPlant();
            }
            else if (activeButton == ButtonState.add && Physics.Raycast(ray, out hit, 1000, stats.terrainMask))
            {
                plants.AddPlant(hit.point);
            }
        }
    }
 /// <summary>
 /// Создание растений в симуляции
 /// </summary>
 private static void NewPlants()
 {
     BlocksSubstance.Add(new Plants());
     Plants.AddPlant(WorldWidth / 2, 0);
     Plants.DieLastPlantInWorld += Plants_DieLastPlantInWorld;
 }
 /// <summary>
 /// Функция создающее новое растение в стандартных координатах при смерти всех растений
 /// </summary>
 private static void Plants_DieLastPlantInWorld()
 {
     Plants.AddPlant(WorldWidth / 2, 0, Genocode.Genomes.GetLastGenocodeIndex());
 }