void OnTriggerEnter2D(Collider2D other) { if (GetComponent <Rigidbody2D>().isKinematic) { return; } if (other.gameObject == IGame.Instance.WallBottomCollider) { BallScriptPtr.setPosition(IGame.Instance.connect2wall(BallScriptPtr.getPosition())); GetComponent <Rigidbody2D>().isKinematic = true; ConnectToBallsInDistance(); return; } }
public BallScriptPointer newBall(LevelData.CellBall _Cell) { BallScriptPointer pball = GetFreeBall(); pball.setPosition(_Cell.position); pball.getBall().isbasic = _Cell.basic; pball.getBall().armor = _Cell.armor; pball.getBall().GetComponent <Rigidbody2D> ().isKinematic = _Cell.frozen; pball.setColor(_Cell.type); pball.getGameObject().SetActive(true); return(pball); //pball.getBall ().isbasic = isbasic ? true : false; }
public BallScriptPointer newBall(Vector3 Position, bool isbasic = false) { BallScriptPointer pball = GetFreeBall(); pball.setPosition(Position); pball.getBall().Refresh(); pball.getBall().isbasic = isbasic ? true : false; pball.getBall().armor = 0; pball.getBall().GetComponent <Rigidbody2D> ().isKinematic = false; if (isbasic) { pball.setColor(Random.Range(0, (int)BALLTYPE.LASTCOLOR)); } else { pball.setColor(random_color()); } pball.getGameObject().SetActive(true); return(pball); }