public static BubbleRule NewRule(BubbleType type) { switch (type) { case BubbleType.eBT_BaseHurt: case BubbleType.eBT_SkillHurt: { return(new TargetRule()); } case BubbleType.eBT_CriticalBaseHurt: case BubbleType.eBT_CriticalSkillHurt: { return(new CriticalHurtRule()); } case BubbleType.eBT_PickUpItem: case BubbleType.eBT_PickUpMoney: { return(new UIRule()); } //case BubbleType.eBT_Exp: //{ // return new ExpRule(); //} } return(new TargetRule()); }
BubbleViewModel TryFindMatch(int row, int column, BubbleType bubbleType) { return(_allBubbles.SingleOrDefault(b => b.Row == row && b.Column == column && b.BubbleType == bubbleType)); }
public Bubble(float xPos, float yPos, Dictionary<BubbleState,Texture2D> textureList, BubbleType bubbleType ) { currentState = BubbleState.APPEARING; this.textureList = textureList; this.pos = new Vector2(xPos, yPos); this.xPos = xPos; this.yPos = yPos; this.maxScale = 0.50f; this.bubbleType = bubbleType; //time required for the joint to stay in this bubble so that it will pop this.popTime = GameConfig.BUBBLE_POP_TIME; //alpha value, 1.0f is default this.alpha = 0.80f; //collision radius this.radius = 25; this.collisionBox = new Rectangle((int)xPos - radius, (int)yPos - radius, radius*2, radius*2); //the duration this bubble remains n screen //when duration is over, it will go to the disappearing state this.stayingDuration = GameConfig.BUBBLE_SOLO_DURATION; this.stayingDurationCtr = stayingDuration; }
public void OnObjectSpawn() { _type = (BubbleType)Random.Range(0, 5); SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>(); Color newColor = Color.black; switch (_type) { case BubbleType.Blue: newColor = Color.blue; break; case BubbleType.Green: newColor = Color.green; break; case BubbleType.Orange: newColor = new Color(0.9764f, 0.4157f, 0.0549f); break; case BubbleType.Red: newColor = Color.red; break; case BubbleType.Yellow: newColor = Color.yellow; break; default: newColor = Color.black; break; } spriteRenderer.color = newColor; }
/// Recurses through Transform.parent to find the GameObject to which ContextView is attached /// Has a loop limit of 100 levels. /// By default, raises an Exception if no Context is found. virtual protected void bubbleToContext(MonoBehaviour view, BubbleType type, bool finalTry) { IContext context = Bootstrapper.Instance?.context; if (context == null) { if (finalTry) { Debug.LogError("Context is null"); } return; } switch (type) { case BubbleType.Add: context.AddView(view); registeredWithContext = true; break; case BubbleType.Remove: context.RemoveView(view); break; default: break; } }
public override void Reset() { CurrentBubbleType = (BubbleType)(Singleton.Instance.Random.Next((int)BubbleType.SIZE)); Pieces = new Vector2(0, 0); Speed = 1000; base.Reset(); }
public DataBubble(DataPoint pos) { this.position = pos; this.targetOffset = new DataPoint(0, 0); this.speed = 0f; this.type = BubbleType.Standard; }
public DataBubble(DataPoint pos, DataPoint target, float speed, BubbleType type) { this.position = pos; this.targetOffset = target; this.speed = speed; this.type = type; }
private void Init() { gameState = GameState.MainMenu; levelState = LevelState.SetUp; cursorState = CursorState.Release; HeldBubbleType = BubbleType.Null; UseableBubbleList = new List <GameObject>(); GetLevelInfo(); if (!LoadProgress()) { SaveProgress(); } if (!LoadConfig()) { SaveConfig(); } else { EventManager.instance.Fire(new UpdateConfig()); } if (SystemInfo.deviceType == DeviceType.Desktop) { int height = Screen.currentResolution.height * 4 / 5; int width = height * 9 / 16; Screen.SetResolution(width, height, false); } }
public Bubble(ushort _Id) { int m = Random.Range(0, (int)BubbleType.Max - 1); Numberos = (BubbleType)m; Id = _Id; }
public void SetupBubble() { if (bubbleType == BubbleType.Random) { if (Random.value < stasisChance) { bubbleType = BubbleType.Stasis; print("Stasis"); } else { bubbleType = BubbleType.Normal; } } switch (bubbleType) { case BubbleType.Normal: spriteRenderer.material.color = normalColors[0]; spriteRenderer.transform.localScale = new Vector3(0.5f, 0.5f); break; case BubbleType.Stasis: spriteRenderer.material.color = stasisColors[0]; spriteRenderer.transform.localScale = new Vector3(0.65f, 0.65f); break; default: break; } }
public static void OtherHurt(int val, Vector3 pos, BubbleType type) { if (val <= 0) { return; } Load(val.ToString(), pos, type, false); }
public BubbleType(BubbleType copy) { name = copy.name; type = copy.type; level = copy.level; spawnChance = copy.spawnChance; growthRate = copy.growthRate; }
public DisappearTask(GameObject obj, float time, Vector2Int pos, List <List <SlotInfo> > map, BubbleType type, bool rollback) { Obj = obj; DisappearTime = time; Pos = pos; Map = map; Type = type; RollBack = rollback; }
public AppearTask(GameObject obj, float time, bool logicChange, Vector2Int pos, List <List <SlotInfo> > map = null, BubbleType type = BubbleType.Null) { Obj = obj; AppearTime = time; Pos = pos; Map = map; Type = type; LogicChange = logicChange; }
private void bubbleToContext(MonoBehaviour view, BubbleType type, bool finalTry) { if (!_hasContextView) { _contextView = FindTheNearestContextView(view, out _hasContextView); } if (_hasContextView && _contextView.context != null) { var context = _contextView.context; switch (type) { case BubbleType.Add: context.AddView(view); registeredWithContext = true; return; case BubbleType.Remove: context.RemoveView(view); return; case BubbleType.Enable: context.EnableView(view); return; case BubbleType.Disable: context.DisableView(view); return; default: throw new ArgumentOutOfRangeException(type.ToString()); } } if (finalTry && type == BubbleType.Add) { //last ditch. If there's a Context anywhere, we'll use it! if (Context.firstContext != null) { Context.firstContext.AddView(view); registeredWithContext = true; return; } var msg = "A view couldn't find a context. Loop limit reached. or " + "A view was added with no context. Views must be added into the hierarchy of their ContextView lest all hell break loose."; msg += "\nView: " + view; throw new MediationException( msg, MediationExceptionType.NO_CONTEXT); } }
public SlotInfo(Vector2Int v, SlotType sType, BubbleType type, BubbleState state, GameObject bubble, Vector3 loc, GameObject entity) { Pos = v; slotType = sType; InsideBubbleType = type; InsideBubbleState = state; ConnectedBubble = bubble; Location = loc; Entity = entity; }
public void UpdateTypeTotals(BubbleType type, int delta) { if (!initialTypeTotals.ContainsKey(type)) { initialTypeTotals[type] = delta; } typeTotals[type] = typeTotals.ContainsKey(type) ? typeTotals[type] + delta : delta; NotifyListeners(); }
private IEnumerator DelayStart(float time) { yield return(new WaitForSeconds(time)); foreach (var t in typePrefabCombos) { currentType = t.Item1; AddObjectToChildren.AddObject(transform, t.Item2, CheckColor); } }
// Adds a bubble type to the front list of the list and pushes other spawn chances to a higher value // This guarantees that the list is sorted in ascending order based on spawn chance void addToSpawnableTypes(BubbleType BubbleType) { BubbleType copy = new BubbleType(BubbleType); foreach (BubbleType bubbleType in spawnableTypes) { bubbleType.spawnChance += copy.spawnChance; } spawnableTypes.Insert(0, copy); }
public BubbleChangeInfo(GameObject obj, BubbleType type, bool placed, GameObject useablebubble, Vector2Int from, Vector2Int to, Vector3 beginPos, Vector3 endPos) { Bubble = obj; Type = type; Placed = placed; UseableBubble = useablebubble; From = from; To = to; BeginPos = beginPos; EndPos = endPos; }
private static BubbleType GetBubbleType(ConversationLineDataControl line) { var matched = ExString.Default(Regex.Match(line.getText(), @"^#([^\s]+)").Groups[1].Value, "-"); var bubbleType = BubbleTypes.FirstOrDefault(b => matched == b.Identifier); if (string.IsNullOrEmpty(bubbleType.Identifier)) { bubbleType = new BubbleType(matched); } return(bubbleType); }
public void PlayImages(float seconds = 1f, BubbleType form = BubbleType.SAY) { type = form; SwitchBubbles(); LoadImages(); //Spine.TrackEntry entry = skeletonAnim.AnimationState.SetAnimation(0, "grow", false); //entry.mixDuration = 0f; //entry.timeScale = 1f; //skeletonAnim.skeleton.a = 1f; StartCoroutine(SwitchImagesCoroutine(seconds)); }
public void SpawnBubble(BubbleType bubbleType) { Vector3 spawnPosition = new Vector3(transform.position.x, Random.Range(-(_boxCollider.size.y / 2), _boxCollider.size.y / 2), 0f); GameObject bubbleGameObject = Instantiate(BubblePrefab, spawnPosition, Quaternion.identity); Bubble bubble = bubbleGameObject.GetComponent <Bubble>(); bubble.TransformType = TransformType; bubble.BubbleType = bubbleType; BubbleManager.AddBubble(bubbleGameObject); }
public void ConstructThrowableBubble() { rbBubble.gravityScale = 0; rbBubble.constraints = RigidbodyConstraints2D.FreezeRotation; rbBubble.velocity = Vector2.zero; rbBubble.angularVelocity = 0; gameObject.layer = LayerMask.NameToLayer("Default"); this.type = BubbleResources.GenerateRandomBubbleType(); this.GetComponent <SpriteRenderer>().sprite = type.sprite; }
private IEnumerator CreateBubbles(int p_count, BubbleType p_bubbleType) { yield return(null); for (int i = 0; i < p_count; i++) { CreateBubble(p_bubbleType); yield return(new WaitForSeconds(0.05f)); } yield return(new WaitForSeconds(1f)); m_checkGoodBubblesCount = true; }
public void SetOther(BubbleType t, Color c) { if (!bInit) { bInit = true; MeshFilter f = GetComponent <MeshFilter>(); f.mesh.Clear(); uint vertexCount = 4; uint indexCount = 6; float fBeginX = -1; Vector3[] pos = new Vector3[vertexCount]; Vector2[] uv = new Vector2[vertexCount]; switch (t) { case BubbleType.eBT_Miss: { FillVertex(pos, uv, 0.46f, 0.5f, 0.54f); } break; case BubbleType.eBT_Dodge: { FillVertex(pos, uv, 0.0f, 0.25f, 0.5f); } break; } f.mesh.vertices = pos; f.mesh.uv = uv; int[] index = new int[indexCount]; index[0] = 0; index[1] = 1; index[2] = 2; index[3] = 2; index[4] = 1; index[5] = 3; f.mesh.triangles = index; f.mesh.bounds = new Bounds(new Vector3(-fBeginX * 2, -1, -1), new Vector3(fBeginX * 2, 1, 1)); MeshRenderer r = GetComponent <MeshRenderer>(); r.material.SetColor("_colorBias", c); color = c; } }
public void OnObjectSpawn(int row, int col, float tileSize) { gameObject.SetActive(true); this.type = BubbleResources.GenerateRandomBubbleType(); if (sprRend == null) { sprRend = GetComponent <SpriteRenderer>(); } this.sprRend.sprite = type.sprite; GenerateNewCoords(row, col, tileSize); }
public MoveTask(GameObject obj, Vector3 begin, Vector3 target, Direction dir, float time, Vector2Int start, Vector2Int end, BubbleType type = BubbleType.Null, List <List <SlotInfo> > map = null, bool teleport = false) { Obj = obj; BeginPos = begin; TargetPos = target; MoveTime = time; Start = start; End = end; Type = type; Dir = dir; Map = map; Teleport = teleport; SetMapInfo(); }
public bool IncreaseNumberos() { int currentNumberos = (int)Numberos; currentNumberos++; int max = (int)BubbleType.Max; if (max <= currentNumberos) { return(false); } Numberos = (BubbleType)currentNumberos; return(true); }
public BubbleCell (BubbleType isLeft) : base (UITableViewCellStyle.Default, isLeft==BubbleType.Left?KeyLeft:isLeft==BubbleType.Right?KeyRight:KeyRightBlue) { var rect = new RectangleF (0, 0, 1, 1); this.isLeft = isLeft; view = new UIView (rect); imageView = new UIImageView (isLeft==BubbleType.Left?left:isLeft==BubbleType.Right?right:rightblue); view.AddSubview (imageView); label = new UILabel (rect) { LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, Font = font, BackgroundColor = UIColor.Clear }; view.AddSubview (label); ContentView.Add (view); }
/// <summary> /// comienza la operacion de busqueda (usar 1 vez desde el primer impacto) /// </summary> /// <param name="matchType"></param> /// <param name="matchByType"></param> /// <returns></returns> public IEnumerator StartNeighborScan(BubbleType matchType, bool matchByType = true) { yield return(null); //Debug.Log("Starting scan at " + this.compoBubble.name); TileGrid.instance.cluster = new List <Bubble>(); processed = false; if (this != null && this.gameObject.activeInHierarchy) { yield return(StartCoroutine(SearchAnidado(matchType, matchByType))); yield return(null); TileGrid.instance.SetCluster(this.compoBubble, !matchByType); // si no matcheo por tipo, fuerzo la operacion de limpiar el cluster del mapa } }
/// Recurses through Transform.parent to find the GameObject to which ContextView is attached /// Has a loop limit of 100 levels. /// By default, raises an Exception if no Context is found. virtual protected void bubbleToContext(MonoBehaviour view, BubbleType type, bool finalTry) { const int LOOP_MAX = 100; int loopLimiter = 0; Transform trans = view.gameObject.transform; while (trans.parent != null && loopLimiter < LOOP_MAX) { loopLimiter++; trans = trans.parent; if (trans.gameObject.GetComponent<ContextView>() != null) { ContextView contextView = trans.gameObject.GetComponent<ContextView>() as ContextView; if (contextView.context != null) { IContext context = contextView.context; bool success = true; switch (type) { case BubbleType.Add: context.AddView(view); registeredWithContext = true; break; case BubbleType.Remove: context.RemoveView(view); break; case BubbleType.Enable: context.EnableView(view); break; case BubbleType.Disable: context.DisableView(view); break; default: success = false; break; } if (success) { return; } } } } if (requiresContext && finalTry && type == BubbleType.Add) { //last ditch. If there's a Context anywhere, we'll use it! if (Context.firstContext != null) { Context.firstContext.AddView(view); registeredWithContext = true; return; } string msg = (loopLimiter == LOOP_MAX) ? msg = "A view couldn't find a context. Loop limit reached." : msg = "A view was added with no context. Views must be added into the hierarchy of their ContextView lest all hell break loose."; msg += "\nView: " + view.ToString(); throw new MediationException(msg, MediationExceptionType.NO_CONTEXT); } }
public void SetType(BubbleType bt) { switch (bt) { case BubbleType.Doc: docType.Visibility = Visibility.Visible; break; case BubbleType.Image: ImageType.Visibility = Visibility.Visible; break; case BubbleType.Media: MediaType.Visibility = Visibility.Visible; break; default: return; } }
public ChatBubble (BubbleType isLeft, string text) : base (text) { this.isLeft = isLeft; }