Beispiel #1
0
 void Update()
 {
     if (!ActiveCastSlot && IdleCastSlots.Count > 0)
     {
         ActiveCastSlot = IdleCastSlots[0];
     }
 }
Beispiel #2
0
        private Slot GetArgumentSlot(CodeGen cg)
        {
            Slot arg;

            if (_block != null && _block.ParameterArray)
            {
                // If not part of parameter array, get the normal parameter slot
                if (!_parameterArray)
                {
                    arg = cg.GetArgumentSlot(_parameter);
                }
                else
                {
                    Debug.Assert(cg.ParamsSlot != null);
                    Debug.Assert(cg.ParamsSlot.Type == typeof(object[]));
                    arg = new IndexSlot(cg.ParamsSlot, _parameter);
                    if (_type != typeof(object))
                    {
                        arg = new CastSlot(arg, _type);
                    }
                }
            }
            else
            {
                arg = cg.GetArgumentSlot(_parameter);
            }
            return(arg);
        }
Beispiel #3
0
    public void Initialize(bool re_init)
    {
        if (initedBefore == false || re_init == true)
        {
            //this.checkPointList = FindObjectsOfType<CheckPoint>().ToList();//find and insert all gameobject with checkpoint script
            this.filemanager        = FileManager.Instance;
            this.achievementmanager = AchievementManager.Instance;
            this.playercursor       = FindObjectOfType <HideCursorScript>();
            this.pauseMenu          = FindObjectOfType <PauseMenu>();
            this.checkPointList.Clear();
            this.currentCheckPointIndex = -1;
            if (ApplicationLevelBoard.Instance.CheckValidGameLevelName(Application.loadedLevelName) == true)
            {
                List <CheckPoint> tempCheckPointList = new List <CheckPoint>();
                tempCheckPointList = FindObjectsOfType <CheckPoint>().OrderBy(go => go.orderPlacement).ToList();
                for (int index = 0; index < tempCheckPointList.Count; ++index)
                {
                    tempCheckPointList[index].indexInList = index;
                    this.checkPointList.Add(tempCheckPointList[index]);
                }

                this.playerobj             = GameObject.FindGameObjectWithTag("Player");
                this.playerinfo            = playerobj.GetComponent <PlayerInfo>();
                this.playerinventory       = playerobj.GetComponent <Inventory>();
                this.playercastslot        = playerobj.GetComponent <CastSlot>();
                this.playerdialoginferface = DialogInterface.Instance;
            }

            this.playerdataPath          = filemanager.GetGameDataPath() + "/" + filemanager.backupFolderName + "/" + "backup_" + playerSaveFileName + ".xml";
            this.predefinedInventoryPath = filemanager.GetGameDataPath() + "/" + predefinedInventorySaveFileName + ".xml";
            initedBefore = true;
        }
    }
Beispiel #4
0
 public void FreeCastSlot(CastSlot castSlot)
 {
     IdleCastSlots.Add(castSlot);
     BusyCastSlots.Remove(castSlot);
     if (castSlot == ActiveCastSlot)
     {
         ActiveCastSlot = null;
     }
 }
Beispiel #5
0
    void Start()
    {
        Transform player = GameObject.FindGameObjectWithTag("Player").transform;

        minimap     = player.FindChild("MiniMapCam");
        alertBarUI  = player.GetComponent <alertbar>();
        castSlotUI  = player.GetComponent <CastSlot>();
        timerUI     = GetComponent <CTimer>();
        dialogUI    = DialogInterface.Instance;
        obectivesUI = QuestManager.Instance;
    }
Beispiel #6
0
 public void FirstTap(Button button)
 {
     if (!ActiveCastSlot)
     {
         MAGIC.I.Fail(MAGIC.FailureCondition.NoCastSlot);
         button.Clear(true);
     }
     else
     {
         Debug.Log($"First Tap: {button.ToString()}");
         BusyCastSlots.Add(ActiveCastSlot);
         IdleCastSlots.Remove(ActiveCastSlot);
         ActiveCastSlot = null;
     }
 }
Beispiel #7
0
    //private bool messageNullTextureError = false;

    // Use this for initialization
    void Start()
    {
        //insert the script reference
        database       = ItemDatabase.Instance;
        playerinfo     = this.GetComponent <PlayerInfo>();   //should be relative the player object attached
        playercastslot = this.GetComponent <CastSlot>();

        tabWidth  = Screen.width * 0.05f;
        tabHeight = tabWidth * 0.5f;
        slotsize  = Screen.width * 0.08f;

        for (int i = 0; i < tabAmount; ++i)
        {
            tabRectList.Add(new Rect(Screen.width * 0.15f + (i) * tabWidth, Screen.height * 0.15f, tabWidth, tabHeight));
        }

        tabNameList.Add("I");
        tabNameList.Add("C");

        pageNameList.Add("Inventory " + currentweight + "g/" + weightlimit + "g");
        pageNameList.Add("Crafting");

        backgroundRect = new Rect(tabRectList[0].xMin, tabRectList[tabAmount - 1].yMax, Screen.width * 0.65f, Screen.height * 0.65f);
        float finePadding = slotsize * 0.25f;

        slotsXstartposition = backgroundRect.xMin + finePadding * 2.5f;
        slotsYstartposition = backgroundRect.yMin + finePadding * 2.5f;
        slotYpadding        = slotXpadding = 1.25f;


        //slotX = (int) ( (backgroundRect.width - finePadding) / (slotsize*slotXpadding ));
        //slotY = (int) ( (backgroundRect.height - finePadding) / (slotsize*slotYpadding ));

        for (int i = 0; i < (slotX * slotY); ++i)     //populate the slot list
        {
            slots.Add(new Item());
            craftslots.Add(new Item());
            inventory.Add(new Item());
        }
        //init weight limit
        CalculateWeightLimit();

        Item tempitem = new Item();

        for (int i = 0; i < database.craftDatabase.Count; ++i)
        {
            tempitem = new Item();
            if (database.craftDatabase[i].id >= 1)
            {
                tempitem.itemname     = database.craftDatabase[i].recipe_name;
                tempitem.id           = database.craftDatabase[i].id;      //using item as representation of crafting recipe information
                tempitem.description  = CreateCraftToolTip(database.craftDatabase[i]);
                tempitem.icon         = database.craftDatabase[i].recipeIcon;
                tempitem.recipeParent = database.craftDatabase[i];
                for (int i2 = 0; i2 < craftslots.Count; ++i2)
                {
                    if (craftslots[i2].id < 0)
                    {
                        tempitem.SelfReloadIcon();
                        ManageCraftRecipeIconDisplay(tempitem);
                        craftslots[i2] = tempitem;
                        break;
                    }
                }
            }
        }
        toolTipRect.width       = slotsize * 5;
        toolTipRect.height      = toolTipRect.width * 0.5f;
        dragItemIconRect.width  = slotsize;
        dragItemIconRect.height = dragItemIconRect.width;

        if (LevelManager.Instance.loadFromContinue == false)
        {
            Debug.Log("load PREDEFINED inventory detected");
            LevelManager.Instance.LoadPreDefinedInventory(LevelManager.Instance.CurrentLevelName);
        }
        else
        {
            Debug.Log("load from CONTINUE inventory detected");
            LevelManager.Instance.LoadPlayerInfo();
        }
    }
Beispiel #8
0
 /// <summary>
 /// Casts a spell at/towards the given vector2 position parameter.
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="screenPosition"></param>
 public static bool CastSpell(CastSlot slot, Vector2 screenPosition)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, screenPosition));
 }
Beispiel #9
0
 /// <summary>
 /// Casts a spell at/towards the given vector3 position parameter
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="objectPosition"></param>
 public static bool CastSpell(CastSlot slot, Vector3 objectPosition)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, objectPosition));
 }
Beispiel #10
0
 /// <summary>
 /// Casts a spell at/towards the position of the mouse.
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="castTime"></param>
 public static bool CastSpell(CastSlot slot, float castTime)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, castTime));
 }
Beispiel #11
0
 /// <summary>
 /// Casts a spell at/towards the position of the mouse.
 /// </summary>
 /// <param name="slot"></param>
 public static bool CastSpell(CastSlot slot)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot));
 }
Beispiel #12
0
 /// <summary>
 /// Casts a spell at/towards the given vector2 position parameter.
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="screenPosition"></param>
 /// <param name="castTime"></param>
 public static bool CastSpell(CastSlot slot, Vector2 screenPosition, float castTime)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, screenPosition, castTime));
 }
Beispiel #13
0
 /// <summary>
 /// SDKSpell instance.
 /// </summary>
 /// <param name="castSlot">The castslot.</param>
 /// <param name="spellSlot">The spellslot.</param>
 public SDKSpell(CastSlot castSlot, SpellSlot spellSlot)
 {
     CastSlot  = castSlot;
     SpellSlot = spellSlot;
 }