void Start() { isOver = false; isFire = false; rigidbody_player = GetComponent <Rigidbody2D>(); cdBar = FindObjectOfType <CoolDownBar>(); hpBar = FindObjectOfType <HealthBar>(); }
public void load(ContentManager content) { _missileManager = new missileManager(Game1.game.Content); _font = Game1.game.Content.Load <SpriteFont>("font"); //set the score items _score = 0; _percentMultiplier = 1.0f; _missileBases = 3; _city = 6; _missileManager = new missileManager(Game1.game.Content); //sets up the missile bases Texture2D HomeBase = Game1.game.Content.Load <Texture2D>("Homebase"); _leftBase = new Buildings(new Rectangle(30, 409, HomeBase.Width, HomeBase.Height), HomeBase, _missileManager); _middleBase = new Buildings(new Rectangle(385, 409, HomeBase.Width, HomeBase.Height), HomeBase, _missileManager); _rightBase = new Buildings(new Rectangle(725, 407, HomeBase.Width, HomeBase.Height), HomeBase, _missileManager); //sets up the selection of buildings Texture2D buildings = Game1.game.Content.Load <Texture2D>("building"); _buildings[0] = new Buildings(new Rectangle(120, 480 - buildings.Height - 17, buildings.Width, buildings.Height), buildings, _missileManager); _buildings[1] = new Buildings(new Rectangle(200, 480 - buildings.Height - 17, buildings.Width, buildings.Height), buildings, _missileManager); _buildings[2] = new Buildings(new Rectangle(280, 480 - buildings.Height - 17, buildings.Width, buildings.Height), buildings, _missileManager); _buildings[3] = new Buildings(new Rectangle(470, 480 - buildings.Height - 17, buildings.Width, buildings.Height), buildings, _missileManager); _buildings[4] = new Buildings(new Rectangle(550, 480 - buildings.Height - 17, buildings.Width, buildings.Height), buildings, _missileManager); _buildings[5] = new Buildings(new Rectangle(630, 480 - buildings.Height - 17, buildings.Width, buildings.Height), buildings, _missileManager); _line = new Lines(Game1.game.Content); //cool down bar _leftBaseCoolDown = new CoolDownBar(Game1.game.Content, new Vector2(_leftBase.GetRectangle.Left - 20, _leftBase.GetRectangle.Top - 20)); _middleBaseCoolDown = new CoolDownBar(Game1.game.Content, new Vector2(_middleBase.GetRectangle.Left - 20, _middleBase.GetRectangle.Top - 20)); _rightBaseCoolDown = new CoolDownBar(Game1.game.Content, new Vector2(_rightBase.GetRectangle.Left - 20, _rightBase.GetRectangle.Top - 20)); _missileAi = new MissileSpawningAI(_missileManager); //set the score items _score = 0; _percentMultiplier = 1.0f; _missileBases = 3; _city = 6; }
public void AddCoolDownBar(string tag, int strength) { if (tag != "") { GameObject coolDownBar = Instantiate(coolDownBarPrefab) as GameObject; CoolDownBar coolDownBarScript = coolDownBar.GetComponent <CoolDownBar>(); coolDownBar.transform.SetParent(transform, false); // set the prefab position coolDownBar.GetComponent <RectTransform>().offsetMax = new Vector2(0, 150 * (transform.childCount - 1) - 400); // init the prefab coolDownBarScript.Init(transform.childCount, tag, strength); } }
public void Awake() { cdBar = GetComponent <CoolDownBar>(); }