void Awake() { InitBall(); colorSwatch = GameObject.Find("Game Master").GetComponent <ColorSwatches>(); animator = this.GetComponent <Animator>(); ChooseBallColor(); }
private void OnEnable() { if (_picker == null) { _picker = transform.GetChild(0); } if (_owner == null) { _owner = transform.parent.parent.parent; if (_menuController == null) { _menuController = _owner.GetComponent <MenuObjectControl>(); } } _picker.GetComponent <ColorPicker>().PreparePicker(_owner, _menuController.EditableData.MainColor.ToColor()); if (_swatch == null) { _swatch = transform.GetChild(1); } if (_swatchManager == null) { _swatchManager = GameObject.FindWithTag("GameController").GetComponent <ColorSwatches>(); } _swatchManager.PrepareSwatch(_swatch.GetChild(0)); }
/// onAwake allows for each inheritance to get all the functionality and still implement other useful functionalities void Awake() { //Get Outside References boundary = GameObject.Find("Game Master").GetComponent <ObjBoundary>(); colorSwatch = GameObject.Find("Game Master").GetComponent <ColorSwatches>(); //Controls rightBound = (Camera.main.pixelWidth / 2.0f); leftBound = (Camera.main.pixelWidth / 2.0f); canRotate = true; //DO STUFF! this.gameObject.tag = "Paddle"; PopulateSides(); CanMove(); CalcDegreeAngle(); teleportToStartPos(); if (numSides > 1) { DestroyOldPaddle(); } colorSwatch.PickNewColor(); //Get the paddle's boundaries from the Boundary class CalcBounds(sides[0]); ySpawn = boundary.getPaddleYAxis(); speed = 25f; }
public bool TryAddNewColorSwatch(ColorSwatch newColorSwatch) { bool wasAdded = false; IQueryable <ColorSwatch> colorSwatchResults = ColorSwatches.Where(entity => entity.Brand == newColorSwatch.Brand && entity.Name == newColorSwatch.Name); if (colorSwatchResults.Count() == 0) { ColorSwatches.Add(newColorSwatch); SaveChanges(); wasAdded = true; Console.WriteLine("Added " + newColorSwatch.Name); } else { ColorSwatch existingColorSwatch = colorSwatchResults.First(); ColorNumber newColorNumber = newColorSwatch.ColorNumbers[0]; IQueryable <ColorNumber> colorNumberResults = ColorNumbers.Where(entity => entity.Number == newColorNumber.Number && entity.ColorSwatchId == existingColorSwatch.Id); if (colorNumberResults.Count() == 0) { newColorNumber.ColorSwatchId = existingColorSwatch.Id; ColorNumbers.Add(newColorNumber); SaveChanges(); wasAdded = true; Console.WriteLine("Added " + newColorNumber.Number + " for " + existingColorSwatch.Name); } } return(wasAdded); }
////////////////////////////////////////////////////////////////// // Use this for initialization public void Start() { Application.targetFrameRate = 60; pm = GetComponent <PaddleMaster>(); bm = GetComponent <BallMaster>(); ColorSwatch = this.gameObject.GetComponent <ColorSwatches>(); pm.PaddleUpgrade(score.getScore()); bm.InvokeBalls(); }
///////////////////////////////////////////////////////////////////////////////// void Awake() { //REFERENCES score = GameObject.Find("Game Master").GetComponent <ScoreCounter>(); colorSwatch = GameObject.Find("Game Master").GetComponent <ColorSwatches>(); gm = GameObject.Find("Game Master").GetComponent <GameMaster>(); this.gameObject.tag = "PaddleSide"; //SET COLOR pcolor = colorSwatch.GetSideColor(transform.GetSiblingIndex()); //The sibling index is what number side this is. GetComponent <SpriteRenderer>().color = pcolor; }