示例#1
0
    public void SetPosition(Vector2Int newPosition, ScenarioState state)
    {
        _position = newPosition;

        ItemData itemData = state.GetItemInPosition(newPosition);

        if (itemData == null || itemData.CollectionType != ItemCollectionType.OnStep)
        {
            return;
        }

        state.CollectItem(itemData, this);
    }
示例#2
0
    public static void CollectFinishMoveItems(this ScenarioState state)
    {
        List <EntityData> allEntities = state.GetAllEntities();

        for (int i = 0; i < allEntities.Count; i++)
        {
            EntityData entity = allEntities[i];

            ItemData itemAtEntityPosition = state.GetItemInPosition(entity.Position);

            if (itemAtEntityPosition == null)
            {
                continue;
            }

            state.CollectItem(itemAtEntityPosition, entity);
        }
    }