Exemplo n.º 1
0
    public override void Initialize(Transform[] objects)
    {
        // list because I don't know size here
        List <Filter> tmpFilters = new List <Filter>();
        int           index      = 0;

        for (int i = 0; i < objects.Length; i++)
        {
            // check performance
            InventoryComponent  invC = objects[i].GetComponent <InventoryComponent>();
            InputComponent      inpC = objects[i].GetComponent <InputComponent>();
            InteractorComponent intC = objects[i].GetComponent <InteractorComponent>();
            MovementComponent   movC = objects[i].GetComponent <MovementComponent>();

            if (invC && inpC && intC && movC)
            {
                tmpFilters.Add(new Filter(index, objects[i].gameObject, invC, inpC, intC, movC));
            }
        }

        filters = tmpFilters.ToArray();

        environmentComponent   = GetComponentInChildren <EnvironmentComponent>();
        transportableComponent = GetComponentInChildren <CartComponent>();
        cartInteractable       = transportableComponent.GetComponent <InteractableComponent>();
        lightComponent         = GetComponentInChildren <LightComponent>();
        //villagerComponent = GetComponentInChildren<VillagerComponent>();
        travelComponent  = GetComponentInChildren <TravelComponent>();
        treeComponents   = GetComponentsInChildren <CollectibleComponent>();
        goapSystem       = GetComponent <GOAPSystem>();
        navMeshComponent = playerGO.GetComponent <NavMeshComponent>();
    }
Exemplo n.º 2
0
    void CreateItem(CollectibleComponent finalItem)
    {
        CollectibleComponent newItem;

        newItem = finalItem;
        //Do thing with item, add to inventory?
        //cartComponent.GetComponent<InventoryComponent>().AddtoInventroy(newItem,cartComponent.GetComponent<InventoryComponent>(), newItem.Quantity);
        if (finalItem.TypeofCollectible == CollectibleComponent.CollectibleType.BATTLEPOTION)
        {
            player.inventoryComponent.AddtoInventroy(newItem, player.inventoryComponent, newItem.Quantity);
        }
        else
        {
            cartComponent.GetComponent <InventoryComponent>().AddtoInventroy(newItem, cartComponent.GetComponent <InventoryComponent>(), newItem.Quantity);
        }
        //return newItem;
    }
Exemplo n.º 3
0
        IEnumerator InitializeCartComponent(CartComponent cartComponent)
        {
            var entityComponent = cartComponent.GetComponent <EntityComponent>();
            var entityHandler   = EntityComponentToEntityHandler[entityComponent];
            var spriteRenderer  = entityHandler.GetComponent <SpriteRenderer>();

            spriteRenderer.color = new Color(0.5f, 0.35f, 0.35f);
            yield break;
        }