Example #1
0
        public Card GetNewBomb(int x, int y, SessionControl.PowerUps p, Vector3 position, int id)
        {
            if (p == null)
            {
                return(null);
            }

            string     prefabKey = string.Format("{0}{1}", p.contentName, (p.color ? Card.chipTypes[id] : ""));
            GameObject o         = ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(prefabKey);

            o.name = p.contentName + (p.color ? Card.chipTypes[id] : "");
            o.transform.position = position;

            Card cardExist = SlotManager.Instance.FindSlot(x, y).GetChip();

            if (cardExist != null)
            {
                o.transform.position = cardExist.transform.position;
            }

            Card chip = o.GetComponent <Card>();

            SlotManager.Instance.FindSlot(x, y).SetChip(chip);
            return(chip);
        }
Example #2
0
        // Make a bomb in the specified location with the ability to transform simple chips in a bomb
        public Card AddPowerup(int x, int y, SessionControl.PowerUps powerup)
        {
            SlotForCard slot = SlotManager.Instance.FindSlot(x, y).GetComponent <SlotForCard>();
            Card        chip = slot.card;
            int         id;

            if (chip)
            {
                id = chip.id;
            }
            else
            {
                id = Random.Range(0, LevelProfile.CurrentLevelProfile.CardCount);
            }

            if (chip)
            {
//				DebugUtil.Debug("destroy card:" + chip.gameObject.name);
                if (chip.move)
                {
                    chip.gravity = false;
                }

                Destroy(chip.gameObject);
            }

            chip = GetNewBomb(slot.slot.Row, slot.slot.Col, powerup, slot.transform.position, id);
            return(chip);
        }
Example #3
0
        void DrawPowerUp()
        {
            for (int x = 0; x < profile.Width; x++)
            {
                for (int y = 0; y < profile.Height; y++)
                {
                    if (DrawSlotButton(x, y, rect, profile))
                    {
                        if (profile.GetPowerup(x, y) == 0)
                        {
                            SessionControl.PowerUps powerup = SessionControl.powerupsNew.Find(pu => pu.levelEditorName == toolID);
                            if (powerup != null)
                            {
                                profile.SetPowerup(x, y, powerup.levelEditorID);
                            }
                        }
                        else
                        {
                            profile.SetPowerup(x, y, 0);
                        }
                    }
                }
            }

            DrawWallPreview(rect, profile);
        }
Example #4
0
        public Card AddPowerup(int x, int y, string powerupName)
        {
            SessionControl.PowerUps powerup = SessionControl.powerupsNew.Find(pu => pu.name == powerupName);
            if (powerup == null)
            {
                return(null);
            }

            return(AddPowerup(x, y, powerup));
        }
Example #5
0
 public Card GetNewBomb(int x, int y, string powerup, Vector3 position, int id)
 {
     SessionControl.PowerUps p = SessionControl.powerupsNew.Find(pu => pu.name == powerup);
     return(GetNewBomb(x, y, p, position, id));
 }