void Start() { animator = GetComponentInChildren <Animator>(); myRigidbody = GetComponentInChildren <Rigidbody>(); chargeBar = FindObjectOfType <ChargeBar>(); currentCharge = maxCharge; chargeBar.SetMaxCharge(maxCharge); DealCharge(-(maxCharge - StartingCharge)); }
void Awake() { controller = GetComponent <Controller2D>(); surrounding = GetComponent <SurroundingCheck>(); chargeBar = GetComponentInChildren <ChargeBar>(); gravity = -(2 * jumpHeight) / Mathf.Pow(jumpAccend, 2); jumpForce = Mathf.Abs(gravity * jumpAccend); input.pHorizontal = 1; state = STATE.IDLE; }
void Awake() { _timerDisplay = CreateGameObject.CreateChildGameObject <TimerDisplay>(transform).GetComponent <TimerDisplay>(); VictoryScreen = CreateGameObject.CreateChildGameObject <VictoryScreen>(transform).GetComponent <VictoryScreen>(); DefeatScreen = CreateGameObject.CreateChildGameObject <DefeatScreen>(transform).GetComponent <DefeatScreen>(); PauseMenu = CreateGameObject.CreateChildGameObject <PauseMenu>(transform).GetComponent <PauseMenu>(); PlayerData = FindObjectOfType <Player>(); _floatingTextDisplay = CreateGameObject.CreateChildGameObject <FloatingTextDisplay>(transform).GetComponent <FloatingTextDisplay>(); _chargeBar = CreateGameObject.CreateChildGameObject <ChargeBar>(transform).GetComponent <ChargeBar>(); _healthBar = CreateGameObject.CreateChildGameObject <HealthBar>(transform).GetComponent <HealthBar>(); _bestTimeDisplay = CreateGameObject.CreateChildGameObject <BestTimeDisplay>(transform).GetComponent <BestTimeDisplay>(); }
public void tagSetup(int playerNumber) { string tag = "P" + playerNumber; this.playerNumber = playerNumber; GameObject hud = GameObject.FindGameObjectWithTag(tag + " HUD"); Debug.Log(tag); playerChargeBar = hud.GetComponentInChildren <ChargeBar>(); playerChargeBar.percentage = 0; Debug.Log("showing..."); playerChargeBar.showBar(true); Debug.Log("SHOWING BAR FOR PLAYER " + tag); }
// Use this for initialization void Start() { gm = GameManager.instance; pm = PrefabManager.instance; rb2d = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); spriteRenderer = GetComponent <SpriteRenderer>(); attackCollider = transform.Find("AttackCollider").GetComponent <Collider2D>(); attackCollider.enabled = false; // UpdateHpText(); // UpdateChargeText(); healthBar = GameObject.Find("HealthBar").GetComponent <HealthBar>(); chargeBar = GameObject.Find("ChargeBar").GetComponent <ChargeBar>(); UpdateHealthBar(); UpdateChargeBar(); }
protected override void LoadContent() { SpriteBatch = new SpriteBatch(GraphicsDevice); //Create the different managers _chargeBar = new ChargeBar(this, SpriteBatch, Graphics, new Vector2((1900 * Window.ClientBounds.Width) / 1980, (1100 * Window.ClientBounds.Height) / 1080)); _sound = new SoundManager(this); _manager = new GameManager(this); _manager.AddPlayer(new Player(this, "jojo", "ball_red", new Vector3(0, -20, 0))); _manager.LoadGame(1); //Create cameras responsible of following the ball CameraClassic = new Camera(Vector3.Zero, 0, 0, BEPUutilities.Matrix.CreatePerspectiveFieldOfViewRH(MathHelper.PiOver4, Graphics.PreferredBackBufferWidth / (float)Graphics.PreferredBackBufferHeight, .1f, 10000)); Camera = new ChaseCameraControlScheme(_manager.Space.Entities[0], new Vector3(0, 7, 0), false, 50f, CameraClassic, this); //Adding event for sound managing _manager.MainPlayer.Ball.Form.CollisionInformation.Events.ContactCreated += Events_ContactCreated; _manager.MainPlayer.Ball.Form.CollisionInformation.Events.DetectingInitialCollision += Events_DetectingInitialCollision; _manager.MainPlayer.Ball.Form.CollisionInformation.Events.CollisionEnded += Events_CollisionEnded; //Loading font and background for HUD FontSystem fontSystem = FontSystemFactory.Create(GraphicsDevice, 2048, 2048); fontSystem.AddFont(TitleContainer.OpenStream($"{Content.RootDirectory}/font-file.ttf")); _background = Content.Load <Texture2D>("Sprites/background_menu"); //Setup the HUD GuiHelper.Setup(this, fontSystem); _hudFont = Content.Load <SpriteFont>("Hud"); _ui = new IMGUI(); }
// Use this for initialization void Awake() { CH = this; }
public void SetChargeBar(ChargeBar c) { chargeBar = c; //player.SetCharge(chargeBar.GetMax()); }