Inheritance: MonoBehaviour
    public IEnumerator SetBoost(float time)
    {
        GameObject newBar = Instantiate(powerBar);

        newBar.transform.parent = gameObject.transform;
        PowerBar newBarScript = newBar.GetComponent <PowerBar>();

        newBarScript.SetPosition();

        newBarScript.ChangeActive(true);
        newBarScript.SetColor(colorManager.GetColor("orange"));

        float time_left = time;

        while (time_left > 0)
        {
            m_currentSpeed_y = p_speed_y * (1 + p_boostPercentage / 100);
            m_currentSpeed_x = p_speed_x * (1 + p_boostPercentage / 100);
            time_left       -= Time.deltaTime;
            newBarScript.SetFill(time_left / time);
            yield return(null);
        }
        m_currentSpeed_y = p_speed_y;
        m_currentSpeed_x = p_speed_x;
        newBarScript.DestroyBar();
    }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     findMatches         = FindObjectOfType <FindMatches>();
     dataTracker         = FindObjectOfType <DataTracker>();
     powerBar            = FindObjectOfType <PowerBar>();
     audioSource         = GetComponent <AudioSource>();
     allAnimals          = new GameObject[width, height];
     currentState        = GameState.WAIT;
     activatedColumnBomb = false;
     activatedRowBomb    = false;
     activatedPower      = false;
     for (int j = 0; j < height; j++)
     {
         float y = j;
         for (int i = 0; i < width; i++)
         {
             float      x                   = i;
             GameObject newAnimalTile       = CreateNewAnimalTile(x, y);
             var        animalTileComponent = newAnimalTile.GetComponent <AnimalTile>();
             animalTileComponent.row    = (int)y;
             animalTileComponent.column = (int)x;
             allAnimals[(int)x, (int)y] = newAnimalTile;
         }
     }
 }
Ejemplo n.º 3
0
        public BaseLevel()
        {
            //declaring positions
            directionGaugePosition    = new Vector2(125f, SacreBleuGame._instance._screenHeight - 50f);
            powerBarPosition          = new Vector2(SacreBleuGame._instance._screenWidth - 75f, SacreBleuGame._instance._screenHeight - 75f);
            buttonPosition            = new Vector2(SacreBleuGame._instance._screenWidth - 150f, SacreBleuGame._instance._screenHeight - 75f);
            counterPosition           = new Vector2(75f, SacreBleuGame._instance._screenHeight / 2 - (0.90f * SacreBleuGame._instance._screenHeight / 2));
            pauseMenuContinuePosition = new Vector2(SacreBleuGame._instance._screenWidth / 2, SacreBleuGame._instance._screenHeight / 2 - 50f);
            pauseMenuRestartPosition  = new Vector2(SacreBleuGame._instance._screenWidth / 2, SacreBleuGame._instance._screenHeight / 2);
            quitPosition = new Vector2(SacreBleuGame._instance._screenWidth / 2, SacreBleuGame._instance._screenHeight / 2 + 50f);
            wonScreenNextLevelPosition  = new Vector2(SacreBleuGame._instance._screenWidth / 2, SacreBleuGame._instance._screenHeight / 2 - 50f);
            wonScreenRetryLevelPosition = new Vector2(SacreBleuGame._instance._screenWidth / 2, SacreBleuGame._instance._screenHeight / 2);

            //setting positions
            _directionGauge           = new DirectionGauge(directionGaugePosition, SacreBleuGame._instance.arrowTexture);
            _powerBar                 = new PowerBar(powerBarPosition, SacreBleuGame._instance.powerBarTexture, SacreBleuGame._instance.basicSquare);
            _hitbutton                = new HitButton(buttonPosition, SacreBleuGame._instance.basicSquare, "hitButton");
            pauseMenuContinueButton   = new ButtonGameObject(pauseMenuContinuePosition, SacreBleuGame._instance.basicSquare, "continueButton");
            pauseMenuRestartButton    = new ButtonGameObject(pauseMenuRestartPosition, SacreBleuGame._instance.basicSquare, "restartButton");
            quitButton                = new ButtonGameObject(quitPosition, SacreBleuGame._instance.basicSquare, "quitButton");
            wonScreenNextLevelButton  = new ButtonGameObject(wonScreenNextLevelPosition, SacreBleuGame._instance.basicSquare, "nextLevelButton");
            wonScreenRetryLevelButton = new ButtonGameObject(wonScreenRetryLevelPosition, SacreBleuGame._instance.basicSquare, "retryLevelButton");

            //GenerateLevel(levelLayout);

            numberOfHits = 0;
            par          = 0;

            entities   = new List <GameObject>();
            bgEntities = new List <GameObject>();
        }
Ejemplo n.º 4
0
    // Start is called before the first frame update

    void Awake()
    {
        ship       = GameObject.Find("Ship");
        powerBar   = GameObject.Find("PowerBar").GetComponent <PowerBar>();
        target     = ship;
        beamTarget = GameObject.Find("BeamTarget");
    }
Ejemplo n.º 5
0
    protected override void OnAttached(EntityLogic childEntity, Transform parentTransform, object userData)
    {
        base.OnAttached(childEntity, parentTransform, userData);

        if (childEntity is PowerBar)
        {
            hpBar = (PowerBar)childEntity;
            hpBar.UpdatePower(fightEntityData.HP, fightEntityData.MaxHP);
            return;
        }
        else if (childEntity is Weapon)
        {
            WeaponData weaponData = (WeaponData)userData;
            Weapon     weapon     = (Weapon)childEntity;

            switch (weaponData.AttackType)
            {
            case WeaponAttackType.手动触发:
                manualWeapons.Add(weapon);
                break;

            case WeaponAttackType.自动触发:
                autoWeapons.Add(weapon);
                break;

            case WeaponAttackType.技能触发:
                skillWeapons.Add(weapon);
                break;
            }
            return;
        }
    }
    void Start()
    {
        powerBar = GameObject.Find("Power").GetComponent <PowerBar>();
        gm       = GameObject.Find("GameManager").GetComponent <GameManager>();

        sm = GameObject.Find("SoundManager").GetComponent <SoundManager>();
    }
Ejemplo n.º 7
0
 // Use this for initialization
 protected void Start()
 {
     gameManagerFSM = gameManagerObj.GetComponent <PlayMakerFSM> ();
     myPowerBar     = GetComponent <PowerBar>();
     //myPowerBar.currentThreshold = ;
     myPowerBar.currentPower = 100;
     FsmVariables.GlobalVariables.FindFsmFloat("TimeLeft").Value = initialTime;
 }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        MainTrainObj = GameObject.Find("Train");
        maintrain    = MainTrainObj.GetComponent <Train> ();
        GameObject pbo = GameObject.Find("PowerBar");

        bar = pbo.GetComponent <PowerBar> ();
    }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     fishKinematic   = Instantiate(fishKinematic);
     distanceMeasure = Instantiate(distanceMeasure);
     distanceBar     = Instantiate(distanceBar);
     powerBar        = GetComponent <PowerBar>();
     StopIndicators();
 }
 // Use this for initialization
 void Start()
 {
     powerBar = GetComponentInChildren<PowerBar> ();
     rb2D = GetComponent<Rigidbody2D> ();
     animator = GetComponent<Animator> ();
     mouseAim = GetComponentInChildren<MouseAim> ();
     isGrounded = true;
     direction = true;
 }
Ejemplo n.º 11
0
    public static PowerBar Instance()
    {
        if (instance = null)
        {
            instance = GameObject.Find("PowerBar").GetComponent <PowerBar>();
        }

        return(instance);
    }
 // Use this for initialization
 void Start()
 {
     powerBar = GetComponentInChildren<PowerBar> ();
     rb2D = GetComponent<Rigidbody2D> ();
     animator = GetComponent<Animator> ();
     mouseAim = GetComponentInChildren<MouseAim> ();
     grapple = GetComponentInChildren<GrappleController>();
     isGrounded = true;
     direction = (transform.localScale.x == 1);
 }
Ejemplo n.º 13
0
 void Awake()
 {
     powerManager          = Component.FindObjectOfType <PowerManager> ();
     stateManager          = Component.FindObjectOfType <StateManager> ();
     turnManager           = Component.FindObjectOfType <TurnManager> ();
     powerBarManager       = Component.FindObjectOfType <PowerBar> ();
     playerSelectorManager = Component.FindObjectOfType <PlayerSelectorManager> ();
     directionManager      = Component.FindObjectOfType <DirectionManager> ();
     arrow = directionManager.arrow;
 }
Ejemplo n.º 14
0
    // Start is called before the first frame update
    void Start()
    {
        timesUpText.enabled = false;
        board        = FindObjectOfType <Board>();
        sceneLoader  = FindObjectOfType <SceneLoader>();
        powerBar     = FindObjectOfType <PowerBar>();
        sessionState = SessionState.NOTSTARTED;

        NewGame();
    }
Ejemplo n.º 15
0
 void Start()
 {
     if (this.name == "PanelSpecial(Clone)")
         CargarGemas();
     else
     {
         barPowr = GameObject.Find("SpecialBar").GetComponent<PowerBar>();
         animaGema = GameObject.Find("GemaBarra").GetComponent<Animator>();
     }
 }
Ejemplo n.º 16
0
 void Start()
 {
     if (this.name == "PanelSpecial(Clone)")
     {
         CargarGemas();
     }
     else
     {
         barPowr   = GameObject.Find("SpecialBar").GetComponent <PowerBar>();
         animaGema = GameObject.Find("GemaBarra").GetComponent <Animator>();
     }
 }
Ejemplo n.º 17
0
 void Start()
 {
     fishIndicators  = GetComponent <FishIndicators>();
     powerBar        = GetComponent <PowerBar>();
     rb              = GetComponent <Rigidbody>();
     respawnRotation = transform.rotation;
     respawnPosition = transform.position;
     isGrounded      = false;
     inControl       = true;
     canceledClick   = false;
     SetJump(0);
 }
Ejemplo n.º 18
0
 void Start()
 {
     ChargeBlocks();
     animaIco        = GameObject.Find("Block").GetComponent <Animator>();
     controlEspecial = GameObject.Find("SpecialBar").GetComponent <PowerBar>();
     ControlesPlayer = GameObject.Find("Inventario").GetComponent <Controles>();
     controleX       = GameObject.Find("Generador").GetComponent <MapGenerator>();
     myRB2D          = gameObject.GetComponent <Rigidbody2D>();
     anima           = gameObject.GetComponent <Animator>();
     mycamera        = GameObject.Find("Camera");
     offset          = mycamera.transform.position;
 }
	// Use this for initialization
	void Start () {
		
		// Create our dynamic textures:
		PowerBarGraphic=new PowerBar();
		HealthBarGraphic=new HealthBar();
		
		// Internally they have now setup the dynamic://healthbar and dynamic://powerbar links for easy access from the html.
		
		// Load the UI from the above HtmlFile:
		if(HtmlFile!=null){
			UI.Html=HtmlFile.text;
		}
	}
    // Use this for initialization
    void Start()
    {
        // Create our dynamic textures:
        PowerBarGraphic  = new PowerBar();
        HealthBarGraphic = new HealthBar();

        // Internally they have now setup the dynamic://healthbar and dynamic://powerbar links for easy access from the html.

        // Load the UI from the above HtmlFile:
        if (HtmlFile != null)
        {
            UI.Html = HtmlFile.text;
        }
    }
    public IEnumerator Invincibility(float time)
    {
        invincible = true;
        GameObject newBar       = Instantiate(powerBar);
        PowerBar   newBarScript = newBar.GetComponent <PowerBar>();

        newBar.transform.parent = gameObject.transform;
        newBarScript.SetPosition();

        invincibilityStar.SetActive(true);
        newBarScript.SetColor(colorManager.GetColor("purple"));

        float time_left      = time;
        float blink_start    = time / 5;
        float blink_interval = .5f;
        float blink_timer    = 0;
        bool  on             = true;

        while (time_left > 0)
        {
            invincible = true;
            if (time_left <= blink_start)
            {
                if (blink_timer <= 0)
                {
                    if (on)
                    {
                        invincibilityStar.SetActive(false);
                        on          = false;
                        blink_timer = blink_interval;
                    }
                    else
                    {
                        invincibilityStar.SetActive(true);
                        on          = true;
                        blink_timer = blink_interval;
                    }
                }
                blink_timer -= Time.deltaTime;
            }
            time_left -= Time.deltaTime;
            newBarScript.SetFill(time_left / time);
            yield return(null);
        }
        invincible = false;
        invincibilityStar.SetActive(false);
        newBarScript.DestroyBar();
    }
Ejemplo n.º 22
0
 void Start()
 {
     coolDown           = 7f;
     coolDownReset      = 7f;
     maxSpeed           = 7.3f;
     objectSpawnCounter = 0;
     powerDecayCounter  = 0;
     powerSpeedCounter  = 0;
     warpCoolDown       = 5f;
     warpCoolDownReset  = 5f;
     powerBar           = GameObject.Find("Power").GetComponent <PowerBar>();
     os = GameObject.Find("ObjectSpawner").GetComponent <ObjectSpawner>();
     mm = GameObject.Find("MusicManager").GetComponent <MusicManager>();
     mm.PlaySound(mm.music[0]);
     //Debug.Log("SPEED is set to "+speed);
 }
Ejemplo n.º 23
0
    // Start is called before the first frame update
    void Start()
    {
        animr = GetComponent <Animator>();
        smg   = FindObjectOfType <SMG>();

        smg.cam = GetComponentInChildren <Camera>();

        controllerMode = true;

        shieldMat = shield.GetComponent <MeshRenderer>().material;

        shieldMat.SetFloat("_Alpha", 0);
        shield.SetActive(false);


        powerBar = FindObjectOfType <PowerBar>();
    }
Ejemplo n.º 24
0
    // Use this for initialization
    void Start()
    {
        /* Future update: This will instead be bars of any shape using SVG and stroke */

        // Create our dynamic textures:
        PowerBarGraphic  = new PowerBar();
        HealthBarGraphic = new HealthBar();

        // Get a reference to the document:
        var document = UI.document;

        // Get the elements (using the shortcut for HtmlElement):
        var powerBar  = document.getById("powerbar");
        var healthBar = document.getById("healthbar");

        // Apply the graphics to them:
        powerBar.SetImage(PowerBarGraphic);
        healthBar.SetImage(HealthBarGraphic);
    }
Ejemplo n.º 25
0
        public MainGame()
        {
            GraphicsManager = new GraphicsDeviceManager(this);
            GraphicsManager.PreferMultiSampling = false;

            paused = false;

            Player   = new Player("man", new Point(5, 5), PLAYER_MOVE_SPEED, PLAYER_JUMP_SPEED);
            Arrow    = new Arrow("arrow", Player.Bounds.Location, 10, Player.Velocity);
            PowerBar = new PowerBar("barborder", new Point(380, 10), "bar", POWER_BAR_CAPACITY);

            Sprites = new LinkedList <Sprite>();
            Sprites.AddLast(Player);
            Sprites.AddLast(Arrow);
            Sprites.AddLast(PowerBar);

            InputManager = new InputManager();

            Content.RootDirectory = "Content";
        }
Ejemplo n.º 26
0
    void Start()
    {
        GameObject go = GameObject.Find("Bag");

        if (go != null)
        {
            _bagMgr = go.GetComponent <BagManager>();
        }

        go = GameObject.Find("PowerBar");
        if (go != null)
        {
            _powerBar = go.GetComponent <PowerBar>();
        }

        go = GameObject.Find("HUDText");
        if (go != null)
        {
            _hudText = go.GetComponent <bl_HUDText>();
        }

        EventDispatcher.Instance.AddListener(Events.GameEvent.ThrowFoodFinish, _OnThrowFoodFinish);
    }
    public IEnumerator Overdrive(float time)
    {
        GameObject newBar       = Instantiate(powerBar);
        PowerBar   newBarScript = newBar.GetComponent <PowerBar>();

        newBar.transform.parent = gameObject.transform;
        newBarScript.SetPosition();

        m_overdrive = true;
        newBarScript.ChangeActive(true);
        newBarScript.SetColor(colorManager.GetColor("green"));
        colorManager.Cancel();
        float time_left = time;
        float shotCD    = 0;
        //Get Rainbow Scoop
        GameObject rainbowScoop = colorManager.GetRainbowScoop();

        while (time_left > 0)
        {
            m_overdrive = true;
            time_left  -= Time.deltaTime;
            newBarScript.SetFill(time_left / time);
            if (shotCD <= 0)
            {
                Shoot(rainbowScoop);
                shotCD = p_overdriveShotInterval;
            }
            else
            {
                shotCD -= Time.deltaTime;
            }

            yield return(null);
        }
        m_overdrive = false;
        newBarScript.DestroyBar();
    }
Ejemplo n.º 28
0
 // Use this for initialization
 protected void Start()
 {
     time       = timeDecaySpeed;
     myPowerBar = GetComponent <PowerBar>();
     myPowerBar.currentPower = 0;
 }
Ejemplo n.º 29
0
 void Start()
 {
     ChargeBlocks();
     animaIco = GameObject.Find("Block").GetComponent<Animator>();
     controlEspecial = GameObject.Find("SpecialBar").GetComponent<PowerBar>();
     ControlesPlayer = GameObject.Find("Inventario").GetComponent<Controles>();
     controleX = GameObject.Find("Generador").GetComponent<MapGenerator>();
     myRB2D = gameObject.GetComponent<Rigidbody2D>();
     anima = gameObject.GetComponent<Animator>();
     mycamera = GameObject.Find("Camera");
     offset = mycamera.transform.position;
 }
Ejemplo n.º 30
0
 void Start()
 {
     if (Instance == null) {
         Instance = this;
     }
 }
Ejemplo n.º 31
0
 void Start()
 {
     PAUSE2 = GameObject.Find("SpecialBar").GetComponent <PowerBar>();
     // referenciamos el scrip player
     palaman = GameObject.Find("Shalike").GetComponent <player>();
 }
Ejemplo n.º 32
0
 public PowerBarItem(PowerBar powerBar)
 {
     this.PowerBar = powerBar;
 }
Ejemplo n.º 33
0
 void Start()
 {
     PAUSE2 = GameObject.Find("SpecialBar").GetComponent<PowerBar>();
     // referenciamos el scrip player
     palaman = GameObject.Find("Shalike").GetComponent<player>();
 }
Ejemplo n.º 34
0
        // private Effect m_Shader;
        // private RenderTarget2D m_ShaderRenderTarget; // might not need this
        // private Texture2D m_ShaderTexture; // might not need this

        public GameScene()
        {
            Tankontroller game = (Tankontroller)Tankontroller.Instance();

            m_TankBaseTexture       = game.CM().Load <Texture2D>("Tank-B-05");
            m_TankBrokenTexture     = game.CM().Load <Texture2D>("BrokenTank");
            m_TankRightTrackTexture = game.CM().Load <Texture2D>("Tank track B-R");
            m_TankLeftTrackTexture  = game.CM().Load <Texture2D>("Tank track B-L");
            m_CannonTexture         = game.CM().Load <Texture2D>("cannon");
            m_CannonFireTexture     = game.CM().Load <Texture2D>("cannonFire");
            m_BulletTexture         = game.CM().Load <Texture2D>("circle");
            mPlayAreaTexture        = game.CM().Load <Texture2D>("playArea");
            mPixelTexture           = game.CM().Load <Texture2D>("block");
            TrackSystem.SetupStaticMembers(game.CM().Load <Texture2D>("track"));
            TeamGUI.SetupStaticTextures(
                game.CM().Load <Texture2D>("port1"),
                game.CM().Load <Texture2D>("port2"),
                game.CM().Load <Texture2D>("port3"),
                game.CM().Load <Texture2D>("port4"),
                game.CM().Load <Texture2D>("port5"),
                game.CM().Load <Texture2D>("port6"),
                game.CM().Load <Texture2D>("port7"),
                game.CM().Load <Texture2D>("port8"));

            JackIcon.SetupStaticTextures(
                game.CM().Load <Texture2D>("leftTrackForward"),
                game.CM().Load <Texture2D>("leftTrackBackwards"),
                game.CM().Load <Texture2D>("rightTrackForward"),
                game.CM().Load <Texture2D>("rightTrackBackwards"),
                game.CM().Load <Texture2D>("fire"),
                game.CM().Load <Texture2D>("charge"),
                game.CM().Load <Texture2D>("none"),
                game.CM().Load <Texture2D>("turretLeft"),
                game.CM().Load <Texture2D>("turretRight"));
            PowerBar.SetupStaticTextures(game.CM().Load <Texture2D>("powerBar_border"),
                                         game.CM().Load <Texture2D>("powerBar_power"));

            m_CircleTexture = game.CM().Load <Texture2D>("circle");

            m_SpriteBatch = new SpriteBatch(game.GDM().GraphicsDevice);

            /*m_Shader = game.CM().Load<Effect>("shader");
             * m_ShaderRenderTarget = new RenderTarget2D(game.GDM().GraphicsDevice,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferWidth,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferHeight);
             * m_ShaderTexture = new Texture2D(game.GDM().GraphicsDevice,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferWidth,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferHeight, false, m_ShaderRenderTarget.Format);
             */
            mBackgroundTexture        = game.CM().Load <Texture2D>("background_01");
            mBackgroundRectangle      = new Rectangle(0, 0, game.GDM().GraphicsDevice.Viewport.Width, game.GDM().GraphicsDevice.Viewport.Height);
            mPlayAreaRectangle        = new Rectangle(game.GDM().GraphicsDevice.Viewport.Width * 2 / 100, game.GDM().GraphicsDevice.Viewport.Height * 25 / 100, game.GDM().GraphicsDevice.Viewport.Width * 96 / 100, game.GDM().GraphicsDevice.Viewport.Height * 73 / 100);
            mPlayAreaOutlineRectangle = new Rectangle(mPlayAreaRectangle.X - 5, mPlayAreaRectangle.Y - 5, mPlayAreaRectangle.Width + 10, mPlayAreaRectangle.Height + 10);
            introMusicInstance        = game.ReplaceCurrentMusicInstance("Music/Music_intro", false);

            mController0 = Tankontroller.Instance().Controller0();
            mController1 = Tankontroller.Instance().Controller1();
            mController2 = Tankontroller.Instance().Controller2();
            mController3 = Tankontroller.Instance().Controller3();
            mController0.ResetJacks();
            mController1.ResetJacks();
            if (DGS.Instance.GetInt("NUM_PLAYERS") > 2)
            {
                mController2.ResetJacks();
                if (DGS.Instance.GetInt("NUM_PLAYERS") > 3)
                {
                    mController3.ResetJacks();
                }
            }

            //loopMusicInstance = game.GetSoundManager().GetLoopableSoundEffectInstance("Music/Music_loopable");  // Put the name of your song here instead of "song_title"
            // game.ReplaceCurrentMusicInstance("Music/Music_loopable", true);
            tankMoveSound = game.GetSoundManager().GetLoopableSoundEffectInstance("Sounds/Tank_Tracks");  // Put the name of your song here instead of "song_title"

            if (DGS.Instance.GetInt("NUM_PLAYERS") < 4)
            {
                setupNot4Player(mPlayAreaRectangle);
            }
            else
            {
                setup4Player(mPlayAreaRectangle);
            }
            foreach (Player p in m_Teams)
            {
                m_World.AddTank(p.Tank);
            }
        }
Ejemplo n.º 35
0
 void Awake()
 {
     stateManager    = Component.FindObjectOfType <StateManager> ();
     turnManager     = Component.FindObjectOfType <TurnManager> ();
     powerBarManager = Component.FindObjectOfType <PowerBar> ();
 }