예제 #1
0
    /// <summary>
    /// Little help here, since they're named little confusing.
    /// Those actually don't activate them in level or anything, but happen AFTER a subsystem has been triggered.
    /// If you want anything special to happen when the player activates a certain number of subsystems, do it here.
    /// If you have levels that use more/less than 3 subsystems mixed with levels that do use 3, you could rewrite so
    /// it uses the amount of subsystems in the level found in level.trigger.count(-1 if it has the levelfinish active).
    /// </summary>
    public void ActivateSubsystem()
    {
        subsystems++;
        if (subsystems == 1)
        {
            Application.GetData().inventory.Add(ItemLibrary.Get().items[0], 1);
            Application.GetData().inventory.Add(ItemLibrary.Get().items[2], 1);
        }
        if (subsystems == 2)
        {
            Application.GetData().inventory.Add(ItemLibrary.Get().keyList[4], 1);
        }
        if (subsystems >= 3)
        {
            for (int i = 0; i < Application.GetData().inventory.content.Count; i++)
            {
                if (Application.GetData().inventory.content[i].item.type == "weap")
                {
                    Weapon w = (Weapon)Application.GetData().inventory.content[i].item;
                    w.currentammo = w.clipsize;
                    w.ammo        = w.maxAmmo;
                }
            }

            ActivateLevelFinish();
        }
    }
예제 #2
0
    static GameManager()
    {
        ItemLibrary itemLibrary = new ItemLibrary();

        MoveManager move = new MoveManager();

        SpaceContoroler space = new SpaceContoroler();

        SkillControler skill = new SkillControler();

        PlayerObjectManager player = new PlayerObjectManager();

        EnemyManager enemy = new EnemyManager();
        MapManager   map   = new MapManager();

        ///////セットアップ
        SeanState.Add(States.MakePlayerObj, new MakePlayerObj(move, player));
        SeanState.Add(States.CameraSetUp, new CameraMoveSetState(move));
        SeanState.Add(States.SetEnemyLibrary, new SetEnemyLibrary(enemy));



        ////////メインシーン
        SeanState.Add(States.Main, new MainState(move, space));
        SeanState.Add(States.MapMove, new MapMoveState(move, enemy, map));
        SeanState.Add(States.AtackState, new AtackState(skill, player, move));
        SeanState.Add(States.EnemyDamage, new EnemyDamageState(skill, player));
        SeanState.Add(States.ChargeSet, new ChargeSetState(skill, player));
        SeanState.Add(States.PlayerFind, new PlayerFindState(move));
        SeanState.Add(States.DethCheck, new DethCheckState(move, enemy));
    }
예제 #3
0
        public static IEnumerable <Item> ItemList()
        {
            ItemLibrary        lib    = new ItemLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
            IEnumerable <Item> result = lib.GetActiveItems().OrderBy(o => o.Short_Name);

            return(result);
        }
예제 #4
0
    public void Initialize(UIManager uiManager, GameObject player)
    {
        mManager         = uiManager;
        this.player      = player;
        this.itemLibrary = uiManager.allManager.itemLibrary;

        gameObject.SetActive(false);

        this.itemBox = player.GetComponent <ItemBox>();
        itemNum      = itemBox.maxItemNum;
        buttonList   = new ItemButton[itemNum];
        selectedItem = -1;
        chosenItem   = -1;

        emptyItemSprite    = Resources.Load <Sprite>(emptyImagePath);
        chosenItemSprite   = Resources.Load <Sprite>(chosenImagePath);
        selectedItemSprite = Resources.Load <Sprite>(selectedImagePath);

        string buttonName = "itemButton ";

        for (int i = 0; i < itemNum; i++)
        {
            buttonList[i] = transform.Find(buttonName + "(" + i + ")").gameObject.GetComponent <ItemButton>();

            if (buttonList[i] != null)
            {
                buttonList[i].Initialize(this, itemLibrary, itemBox.itemList[i], i);
            }
        }
    }
예제 #5
0
    public Item(ItemLibrary itemLibrary,
                int id, String name = "   ", GameObject prefab = null, Sprite image = null, int usageOrder = -1, int usagePara = 0)
    {
        this.itemLibrary = itemLibrary;

        itemID   = id;
        itemName = name;

        if (prefab == null)
        {
            itemPrefab = defaultPrefab;
        }
        else
        {
            itemPrefab = prefab;
        }

        if (image == null)
        {
            itemImage = defaultImage;
        }
        else
        {
            itemImage = image;
        }

        this.usageOrder = usageOrder;
        this.usagePara  = usagePara;
    }
예제 #6
0
        //---------------------------------------------------------------------------------------------

        public static bool IsSummon(UOCharacter ch)
        {
            bool result = false;

            if (ch.Renamable || Game.IsMob(ch.Serial) || Game.IsMobRenamed(ch.Serial))
            {
                result = true;
            }

            if (!result)
            {
                foreach (IUOItemType itemType in ItemLibrary.PlayerSummons)
                {
                    if (itemType.Graphic == ch.Model && itemType.Color == ch.Color)
                    {
                        if (ItemLibrary.IsMonsterConflictSummon(ch))
                        {
                            IUOItemType conflictType = ItemLibrary.GetMonsterConflictSummon(ch);
                            string      defaultName  = (conflictType.Name + String.Empty).Replace(" ", "").ToLower();
                            string      compareName  = (ch.Name + String.Empty).Replace(" ", "").ToLower();
                            result = !compareName.Contains(defaultName);
                        }
                        else
                        {
                            result = true;
                        }


                        break;
                    }
                }
            }

            return(result);
        }
        // Creation logic
        #region
        public static Item CreateItemFromStringReference(string itemName)
        {
            Item data = ItemLibrary.GetItemDataByName(itemName);
            Item item = new Item(data);

            return(item);
        }
예제 #8
0
 private void Awake()
 {
     _instance = this;
     generateImageNames();
     generateInfos();
     generateLabels();
     generateItems();
 }
예제 #9
0
    private void Start()
    {
        itemLibrary = GameObject.Find("ItemLibrary").GetComponent <ItemLibrary>();

        if (!itemLibrary)
        {
            Debug.LogError("Item Library not found!");
        }
    }
    public void CreateReward(List <Item> reward)
    {
        DialogueItem i = Instantiate <DialogueItem>(itemPrefab, content.transform);

        i.SetText("");
        dialogues.Add(i);
        item.AddItems(ItemLibrary.GenerateAmounts(reward, 500)); //placeholder value
        item.SetText("Yours for the taking...");
    }
예제 #11
0
    public static ItemLibrary Get()
    {
        if (instance == null)
        {
            instance = new ItemLibrary();
            instance.Init();
        }

        return(instance);
    }
    public static ItemLibrary Get()
    {
        if (instance == null)
        {
            instance = new ItemLibrary();
            instance.Init();
        }

        return instance;
    }
예제 #13
0
        public static Item GeItemByID(string id)
        {
            int itemID = 0;

            int.TryParse(id, out itemID);

            ILibrary <Item> lib = new ItemLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());

            return(lib.GetByID(itemID.ToString()));
        }
예제 #14
0
 void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
예제 #15
0
    public RecipeData(RecipeDataImporter Settings)
    {
        mProduceItem = new ItemStack(ItemLibrary.GetID(Settings.mProduceName), Settings.mProduceAmount);
        mIngredients = new ItemStack[Settings.mIngredientsAmounts.Length];


        for (int i = 0; i < Settings.mIngredientsAmounts.Length; ++i)
        {
            mIngredients[i] = new ItemStack(ItemLibrary.GetID(Settings.mIngredientsNames[i]), Settings.mIngredientsAmounts[i]);
        }
    }
예제 #16
0
    void Start()
    {
        itemLibrary = GetComponent <ItemLibrary>();
        itemLibrary.Initialize();

        itemManager            = new ItemManager(this, dropItemPool, dropItemPoolSize);
        worldObjectManager     = new WorldObjectManager(this, worldObjectTemplateList, worldObjectPool, worldObjectPoolSize);
        characterObjectManager = new CharacterObjectManager(this, characterObjectTemplateList, characterObjectPool, characterObjectPoolSize);

        uiManager = new UIManager(this);
    }
예제 #17
0
 public void PlayerSelectItem()
 {
     OverlayView.Instance.ShowOverlay(OverlayView.Overlay.ItemView, (i) => {
         var item     = Player.Instance.Items.GetElements()[i];
         var itemtype = ItemLibrary.Lookup(item.Name);
         if (itemtype.UsableInFight)
         {
             UnityEngine.Debug.Log("use item");
             itemtype.OnUse.Invoke(() => action = new PlayerAction(i, PlayerAction.ActionType.Item));
         }
     });
 }
예제 #18
0
    void Start()
    {
        //Set Sprite of Pickup
        GetComponent <SpriteRenderer>().sprite = ItemLibrary.GetItem(itemToPickUp).icon;

        //Add Random Direction and Magantude Force
        rig = GetComponent <Rigidbody2D>();
        rig.AddForce(Random.Range(range.x, range.y) * new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)));

        //Set Lifetime To Destroy
        Destroy(gameObject, lifeTime);
    }
    public Level Generate()
    {
        Level          levelGen = new Level();
        LevelFromImage lfi      = new LevelFromImage();

        levelGen.structure = lfi.BuildStructure();
        lfi.AddObjectsFromImage(levelGen);

        if (lfi.output.playerSpawns <= 0)
        {
            levelGen.playerSpawnPoints = SetPlayerSpawnPoints(levelGen);
        }

        //levelGen.pickupSpawnPoints = SetPickupSpawnPoints();
        //levelGen.enemySpawnPoints = SetEnemySpawnPoints();

        pickUpCount = ((levelGen.structure.GetLength(0) * levelGen.structure.GetLength(1)) / 100);
        //int factor = ((levelGen.structure.GetLength(0) + levelGen.structure.GetLength(1) / 100));
        int factor = 1;

        pickUpCount = pickUpCount + (rng.Next(0, 10) * factor);

        enemyCount     = pickUpCount * 2;
        pickUpCount   += 10;
        maxMeleeCount  = enemyCount / 2;
        maxRangedCount = (enemyCount / 2) - 1;
        maxBossCount   = 1;
        /**/

        /*
         * for (int i = 0; i < enemyCount; i++)
         * {
         *  if (rng.Next(0, 2) == 0 && !(maxMeleeCount >= enemyCount / 2 + (rng.Next(-5, 5))) && !(maxMeleeCount + maxRangedCount + maxBossCount >= enemyCount)) maxMeleeCount++;
         *  if (rng.Next(0, 2) == 1 && !(maxRangedCount >= enemyCount / 2 + (rng.Next(-5, 5))) && !(maxMeleeCount + maxRangedCount + maxBossCount >= enemyCount)) maxRangedCount++;
         *  if (rng.Next(0, 2) == 2 && !(maxBossCount >= enemyCount/20) && !(maxMeleeCount + maxRangedCount + maxBossCount >= enemyCount)) maxBossCount++;
         * }
         * /**/


        for (int i = 0; i < enemyCount; i++)
        {
            //int current = rng.Next(0, levelGen.enemySpawnPoints.Count);
            levelGen.enemies.Add(SpawnEnemy(levelGen));
            //levelGen.enemySpawnPoints.RemoveAt(current);
        }

        for (int i = 0; i < pickUpCount; i++)
        {
            //int current = rng.Next(0, levelGen.pickupSpawnPoints.Count);
            levelGen.pickUps.Add(SpawnPickup(levelGen, rng.Next(0, ItemLibrary.Get().generics.Count)));
            //levelGen.pickupSpawnPoints.RemoveAt(current);
        }
예제 #20
0
    /// <summary>
    /// Perform the setup and import for all assets
    /// </summary>
    public static void AttemptImport(bool ForceReimport = false)
    {
        if (!bIsLoaded || ForceReimport)
        {
            VoxelLibrary.ImportBaseSettings();
            ItemLibrary.ImportBaseSettings();
            RecipeLibrary.ImportBaseSettings();

            VoxelLibrary.BuildFromImport();
            ItemLibrary.BuildFromImport();
            RecipeLibrary.BuildFromImport();
            bIsLoaded = true;
        }
    }
        public override async Task AddOrUpdateInclusive(MovieLibrary library)
        {
            IList <ItemLibrary> existingItemLibraries = MediaCloudContext.ItemLibraries.ToList();
            IList <ItemGenre>   existingItemGenres    = MediaCloudContext.ItemGenres.ToList();

            //Don't re-add existing items
            foreach (ItemLibrary itemLibrary in library.ItemLibraries)
            {
                ItemLibrary existingItemLibrary = existingItemLibraries.FirstOrDefault(x => x.ItemId == itemLibrary.Item.Id);

                if (existingItemLibrary != null)
                {
                    MediaCloudContext.Entry(itemLibrary.Item).State = EntityState.Unchanged;
                    itemLibrary.ItemId = existingItemLibrary.ItemId;
                }
                else
                {
                    existingItemLibraries.Add(itemLibrary);
                }

                //Don't re-add existing genres
                foreach (ItemGenre itemGenre in itemLibrary.Item.ItemGenres)
                {
                    ItemGenre existingItemGenre =
                        existingItemGenres.FirstOrDefault(x => x.GenreId == itemGenre.Genre.Id);

                    if (existingItemGenre != null)
                    {
                        Entities.Genre localEntry = MediaCloudContext.Set <Entities.Genre>().Local.FirstOrDefault(entry => entry.Id == itemGenre.Genre.Id);

                        //Make sure an already attached genre isn't attached again
                        if (localEntry != null)
                        {
                            MediaCloudContext.Entry(localEntry).State = EntityState.Detached;
                        }

                        MediaCloudContext.Entry(itemGenre.Genre).State = EntityState.Unchanged;
                        itemGenre.GenreId = existingItemGenre.GenreId;
                    }
                    else
                    {
                        existingItemGenres.Add(itemGenre);
                    }
                }
            }

            await MediaCloudContext.MovieLibraries.AddAsync(library);

            await MediaCloudContext.SaveChangesAsync();
        }
예제 #22
0
        public static void print_and_exit()
        {
            if (in_print_and_exit == false)
            {
                in_print_and_exit = true;

                seg044.PlaySound(Sound.sound_FF);

                Logger.Close();

                ItemLibrary.Write();

                seg001.EngineStop();
            }
        }
예제 #23
0
    public Actor()
    {
        this.name              = "player";
        this.position          = new Vector2();
        this.selector          = new GameObject();
        this.selector.position = new Vector2(0, 0);

        this.actions   = maxActions;
        this.Weapon    = new Slot <Weapon>();
        this.Armor     = new Slot <Armor>();
        Weapon.content = new Weapon(ItemLibrary.Get().weaponList[0]);
        Armor.content  = new Armor(ItemLibrary.Get().armorList[0]);

        XselecRange = Weapon.content.range;
    }
예제 #24
0
    public void Initialize(ItemPanel itemPanel, ItemLibrary itemLibrary, int itemID, int buttonOrder)
    {
        this.itemPanel   = itemPanel;
        this.itemLibrary = itemLibrary;
        this.itemID      = itemID;
        this.buttonOrder = buttonOrder;

        itemImage               = transform.Find("Image").gameObject.GetComponent <Image>();
        this.emptyItemSprite    = itemPanel.emptyItemSprite;
        this.chosenItemSprite   = itemPanel.chosenItemSprite;
        this.selectedItemSprite = itemPanel.selectedItemSprite;

        UpdateItemImage();

        onClick.AddListener(SelectItem);
    }
예제 #25
0
    //Inventory Management Functions
    public bool AddItemToInventory(int itemIDToAdd)
    {
        Item itemToAdd = ItemLibrary.GetItem(itemIDToAdd);

        if (currentWeight + itemToAdd.weight < maxWeight)
        {
            inventory.Add(itemToAdd);
            UpdateWeight();
            InventoryChanged();
            return(true);
        }
        else
        {
            InventoryChanged();
            return(false);
        }
    }
        public static void CreateItemsOnTurnCycleStart(int itemsToCreate)
        {
            for (int i = 0; i < itemsToCreate; i++)
            {
                // Get a random valid spawn location for the item
                Tile spawnLocation = WorldController.GetAllValidNewItemLocationTiles(WorldController.currentWorld)
                                     [new Random().Next(0, WorldController.GetAllValidNewItemLocationTiles(WorldController.currentWorld).Count)];

                // Was a valid spawning tile actually found?
                if (spawnLocation != null)
                {
                    // Create a new random item
                    Item newRandomItem = ItemController.CreateItemFromItemData(ItemLibrary.GetRandomItemData());

                    // Place item at the spawn location
                    ItemController.PlaceItemOnTile(spawnLocation, newRandomItem);
                }
            }
        }
예제 #27
0
    public void InitializeItemBox(int maxNumber, int[] iniHold) // be called in the respective manager, e.g. WorldObjectManager / CharacterObjectManager
    {
        maxItemNum   = maxNumber;
        itemList     = new int[maxItemNum];
        defaultEmpty = 0;
        itemLibrary  = GetComponent <Basic>().mManager.allManager.itemLibrary;
        itemManager  = GetComponent <Basic>().mManager.allManager.itemManager;

        int tempIndex = (iniHold.Length < maxItemNum) ? iniHold.Length : maxItemNum;

        itemNum = 0;

        for (int i = 0; i < maxItemNum; i++)
        {
            itemList[i] = -1;
        }

        for (int i = 0; i < iniHold.Length && itemNum < maxNumber; i++)
        {
            ObtainItem(iniHold[i]);
        }
    }
예제 #28
0
    // Use this for initialization
    void Start()
    {
        this.nextLevel     = 3;
        money              = 0;
        this.activeWeapon  = new NonItem();
        this.activeDefense = new NonItem();
        this.activeUtility = new NonItem();
        this.library       = new ItemLibrary();
        this.activeWeapon  = this.library.GetItem("GrenadeLauncher");
        this.health        = 100f;

        GameObject oldData = GameObject.Find("oldPersistentData");

        if (oldData != null)
        {
            this.money += oldData.GetComponent <TestMenu>().money;
            Destroy(oldData);
        }
        GameObject returnData = GameObject.Find("returnPersistentData");

        if (returnData != null)
        {
            TestMenu data = returnData.GetComponent <TestMenu>();
            this.money        += data.money;
            this.nextLevel     = data.nextLevel;
            this.activeWeapon  = data.activeWeapon;
            this.activeUtility = data.activeUtility;
            this.activeDefense = data.activeDefense;
            this.health        = data.health;
            this.library       = data.library;
            Destroy(returnData);
        }

        DontDestroyOnLoad(transform.gameObject);
        availableWeapons = new string[] { "Projectile", "Lazer", "BurstJump", "Rush", "SpeedBurst", "GrenadeToss", "DeathLazer" };
        weaponData       = new string[] { availableWeapons [0], availableWeapons [0], availableWeapons [0], availableWeapons [0] };
        buttonTracker    = new int[] { 0, 0, 0, 0 };
        armorData        = new double[] { 1.0, 1.0, 1.0, 1.0 };
    }
예제 #29
0
        public void ItemClicked(BaseEventData e)
        {
            if (!(e is PointerEventData))
            {
                return;
            }
            var a = e as PointerEventData;


            var index = a.pointerEnter.transform.parent.GetSiblingIndex() - 1; // minus 1 because template object
            var item  = Items[index];

            var itemtype = ItemLibrary.Lookup(item.Name);

            if (OverlayView.Instance.isActive)
            {
                OverlayView.Instance.Value = index;
                return;
            }


            if ((Game.Instance.CurrentGameState & Game.GameState.Battle) != 0)
            {
                if (itemtype.UsableInFight)
                {
                    UnityEngine.Debug.Log("use item");
                    itemtype.OnUse.Invoke(() => {});
                }
            }
            if ((Game.Instance.CurrentGameState & Game.GameState.World) != 0)
            {
                if (itemtype.UsableInWorld)
                {
                    UnityEngine.Debug.Log("use item");
                    itemtype.OnUse.Invoke(() => { });
                }
            }
        }
예제 #30
0
    public void SpawnPlayer()
    {
        player           = new Actor();
        player.health    = 10;
        player.maxHealth = 10;

        Application.GetData().inventory.Add(player.Weapon.content, 1);
        Application.GetData().inventory.Add(player.Armor.content, 1);

        Application.GetData().inventory.Add(ItemLibrary.Get().grenadeList[1], 1);
        Application.GetData().inventory.Add(ItemLibrary.Get().armorList[4], 1);

        //DEBUGGING ONLY, DONT TOUCH IF YOU DONT KNOW WHAT YOU'RE DOING

        /*
         * Application.GetData().inventory.Add(ItemLibrary.Get().items[0], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().weaponList[5], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().grenadeList[0], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().grenadeList[1], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().usableList[0], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().usableList[1], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().usableList[2], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().weaponList[1], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().weaponList[2], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().keyList[0], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().keyList[1], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().keyList[2], 1);
         * Application.GetData().inventory.Add(ItemLibrary.Get().keyList[3], 1);
         * //player.AddTrait(2, "temp", new HeavyInjuryTrait(5));
         * /**/

        Random rng = new Random();

        player.position = level.playerSpawnPoints[rng.Next(0, 4)];

        Application.GetData().collision.Add(player);
    }
예제 #31
0
    //call after new container data is assigned
    void InitializeButtons()
    {
        itemLibrary = GameObject.FindGameObjectWithTag ("mc").GetComponent<ItemLibrary> ();
        buttonList = new Button[storage.size];

        RectTransform slotRect = buttonPrefab.GetComponent<RectTransform> ();
        RectTransform containerRect = gameObject.GetComponent<RectTransform> ();

        float width = slotRect.rect.width * storage.size;
        float height = slotRect.rect.height;

        //adjust container height to fit buttons
        containerRect.offsetMin = new Vector2 (containerRect.offsetMin.x, 0);
        containerRect.offsetMax = new Vector2 (containerRect.offsetMin.x + width, containerRect.offsetMin.y + height);

        for (int i = 0; i < storage.size; i += 1) {
            //create our prefab slot
            GameObject newSlot = Instantiate(buttonPrefab) as GameObject;
            newSlot.transform.SetParent(gameObject.transform);

            //reposition
            RectTransform thisRect = newSlot.GetComponent<RectTransform> ();
            thisRect.offsetMin = new Vector2(containerRect.offsetMin.x + (slotRect.rect.width * i), 0);
            thisRect.offsetMax = new Vector2(containerRect.offsetMin.x + (slotRect.rect.width * i) + slotRect.rect.width, 0);
            thisRect.localScale = new Vector3(1, 1, 1);

            //save a reference to this slot and add a handler
            Button thisButton = newSlot.GetComponent<Button>();
            buttonList[i] = thisButton; //save for later
            int capture = i;
            thisButton.onClick.AddListener(() => leftclickSlot(capture));

            //refresh image and number
            refreshItem(i);

        }
    }
예제 #32
0
 void Start()
 {
     itemLibrary = GameObject.FindGameObjectWithTag ("mc").GetComponent<ItemLibrary> ();
 }
예제 #33
0
 private void Awake()
 {
     _instance = this;
 }