//Step function returns whether is moves or not during the step.
    public EntityController.EntityStepData Step()
    {
        //wheel
        moving = toggleableScript.state;
        if (moving && wheelableScript.disbanded)
        {
            List <EntityController.Entity> friends = LookForFriends();
            friends.Add(entityScript.selfEntity);

            Debug.Log("initiating car");

            Vector3    position   = transform.position;
            GameObject gridObject = entityController.AddEntity(position.x, position.y, "car", false, friends).obj;
            if (gridObject == null)
            {
                Debug.Log("car not loaded");
            }

            toggleableScript.Toggle();


            Debug.Log("finished initiating car");
        }

        //will move whenever active
        return(new EntityController.EntityStepData(moving, false));
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Работа с сущностью при нажатии ОК.
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="ec"></param>
 public override void ApplyChanged(EntityBase entity, EntityController ec)
 {
     if (entity as Hierarchy != null)
     {
         var entities = ec.AddRangeHierarchy(entity as Hierarchy, countCopy).ToArray();
         ec.SaveChanges();
         HierarchyChangedRange?.Invoke(entities);
     }
     else
     {
         ec.AddEntity(entity);
         ec.SaveChanges();
         EntityChanged?.Invoke(entity);
     }
 }
    public void PlaceEntity(string objName)
    {
        Vector3 position = cursorSelection.transform.position;

        entityController.AddEntity(position.x, position.y, objName);
    }