Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        gamecamera             = GameObject.FindGameObjectWithTag("MainCamera");
        cameraFollow           = (CameraFollow)gamecamera.GetComponent("CameraFollow");
        pauseMenu              = (PauseMenu)gamecamera.GetComponent("PauseMenu");
        goPlayer               = GameObject.FindGameObjectWithTag("Player");
        anim                   = gameObject.GetComponent <Animator>();
        rb2d                   = gameObject.GetComponent <Rigidbody2D>();
        currentTimeInAssault   = 0f;
        countJumpUntilAssault  = 0;
        isInAssault            = false;
        firstMovementToAssault = false;
        isTouchFloor           = true;
        isLaunchPowerUp        = false;
        //------------- Colisiones a ignorar.
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY, UserInterfaceGraphics.LAYER_ENEMY, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY_SHOOT, UserInterfaceGraphics.LAYER_ENEMY, true);
        //------------- Calcular ancho de la cámara.
        widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
        //------------- Creo la sombra del enemigo.
        shadow = GameObject.Instantiate <GameObject>(shadowPrefabs);
        ShadowCharacter sc = (ShadowCharacter)shadow.GetComponent("ShadowCharacter");

        sc.characterToFollow = gameObject;
    }
    // Use this for initialization
    void Start()
    {
        gamecamera = GameObject.FindGameObjectWithTag("MainCamera");

        //------------- Calcular ancho de la cámara.
        widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
    }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        gamecamera    = GameObject.FindGameObjectWithTag("MainCamera");
        cameraFollow  = (CameraFollow)gamecamera.GetComponent("CameraFollow");
        isBlockCamera = true;
        isActive      = false;

        //------------- Calcular ancho de la cámara.
        widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
    }
    void Start()
    {
        isInit            = true;
        numberLevel       = 0;
        currentPointLevel = 0;
        notificateNewLevel();

        gamecamera = GameObject.FindGameObjectWithTag("MainCamera");
        //------------- Calcular ancho de la cámara.
        widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
    }
    // Use this for initialization
    void Start()
    {
        isCalledEnemies   = false;
        unlockCamera      = false;
        isEnd             = false;
        numEnemiesCreated = 0;
        gamecamera        = GameObject.FindGameObjectWithTag("MainCamera");
        blockCamera       = (BlockCamera)gameObject.GetComponent("BlockCamera");
        enemiesCreated    = new System.Collections.Generic.List <GameObject>();

        //------------- Calcular ancho de la cámara.
        widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
    }
    void Start()
    {
        // Lo típico.
        gamecamera            = GameObject.FindGameObjectWithTag("MainCamera");
        cameraFollow          = (CameraFollow)gamecamera.GetComponent("CameraFollow");
        pauseMenu             = (PauseMenu)gamecamera.GetComponent("PauseMenu");
        goPlayer              = GameObject.FindGameObjectWithTag("Player");
        player                = (Player)goPlayer.GetComponent("Player");
        anim                  = gameObject.GetComponent <Animator>();
        rb2d                  = gameObject.GetComponent <Rigidbody2D>();
        isTouchFloor          = true;
        currentTimeLaunchMine = 0f;
        //------------- Colisiones a ignorar.
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY, UserInterfaceGraphics.LAYER_ENEMY, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY_SHOOT, UserInterfaceGraphics.LAYER_ENEMY, true);
        //------------- Calcular ancho de la cámara.
        widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
        //------------- Creo la sombra del enemigo.
        shadow = GameObject.Instantiate <GameObject>(shadowPrefabs);
        ShadowCharacter sc = (ShadowCharacter)shadow.GetComponent("ShadowCharacter");

        sc.characterToFollow = gameObject;

        // Creamos estrategias e inicializamos variables asociadas a las mismas.
        strategies = new Strategy[] { new StopStrategy(1f, this), new StopStrategy(0.5f, this),
                                      new JumpStrategy(-1f, this), new CallEnemiesStrategy(-1f, this),
                                      new FlyTypeZ(-1f, this), new AssaultStrategy(-1, this), new StopStrategy(2f, this) };
        indexCurrentStrategy = 0;
        isIn23      = true;
        isIn13      = false;
        currentJump = 0;
        maxLife     = currentLife;
        // Como al inicio estamos en idle (y no en RUN o JUMP), activo las manos, desactivo el boss.
        enableHands(true);
        isActive = false;
        // No está parpadeando en rojo al inicio.
        currentTimeBlink = 0;
        isInRedColor     = false;
        isBlinkInRed     = false;
        // Desactivo colisiones que no necesito.
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_BOSS, UserInterfaceGraphics.LAYER_ENEMY, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_BOSS, UserInterfaceGraphics.LAYER_ENEMY_SHOOT, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_BOSS, UserInterfaceGraphics.LAYER_POWER_UP, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_BOSS_HANDS, UserInterfaceGraphics.LAYER_ENEMY, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_BOSS_HANDS, UserInterfaceGraphics.LAYER_ENEMY_SHOOT, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_BOSS_HANDS, UserInterfaceGraphics.LAYER_POWER_UP, true);
    }
Beispiel #7
0
    // Use this for initialization
    void Start()
    {
        gamecamera       = GameObject.FindGameObjectWithTag("MainCamera");
        cameraFollow     = (CameraFollow)gamecamera.GetComponent("CameraFollow");
        pauseMenu        = (PauseMenu)gamecamera.GetComponent("PauseMenu");
        goPlayer         = GameObject.FindGameObjectWithTag("Player");
        player           = (Player)goPlayer.GetComponent("Player");
        anim             = gameObject.GetComponent <Animator>();
        rb2d             = gameObject.GetComponent <Rigidbody2D>();
        isLookingToRight = true;
        isInAttackMode   = false;
        timeToAttack     = 0;
        timeInAttack     = TIME_IN_ATTACK;
        //------------- Colisiones a ignorar.
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY, UserInterfaceGraphics.LAYER_ENEMY, true);
        Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY_SHOOT, UserInterfaceGraphics.LAYER_ENEMY, true);
        //------------- Calcular ancho de la cámara.
        widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
        //------------- Creo la sombra del enemigo.
        shadow = GameObject.Instantiate <GameObject>(shadowPrefabs);
        ShadowCharacter sc = (ShadowCharacter)shadow.GetComponent("ShadowCharacter");

        sc.characterToFollow = gameObject;
    }
Beispiel #8
0
 // Use this for initialization
 void Start()
 {
     Player.score          = 0;
     Player.timeGame       = 1000;
     gamecamera            = GameObject.FindGameObjectWithTag("MainCamera");
     cameraFollow          = (CameraFollow)gamecamera.GetComponent("CameraFollow");
     pauseMenu             = (PauseMenu)gamecamera.GetComponent("PauseMenu");
     rb2d                  = gameObject.GetComponent <Rigidbody2D>();
     anim                  = gameObject.GetComponent <Animator>();
     currentLife           = maxLife;
     timerAttack           = 0;
     timeMatrix            = 0;
     timeToRefleshTimeGame = 0;
     timeToShowGo          = 0;
     isLookingToRight      = true;
     goAlertArrow.GetComponent <Renderer>().enabled = false;
     activeBlinkHurt  = false;
     currentTimeBlink = 0;
     //------------- Calcular ancho de la cámara.
     widthCamera = UserInterfaceGraphics.getWidthCamera() / 2;
     // Para cuando muere el player y vuelve a iniciarse el juego.
     Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY_SHOOT, UserInterfaceGraphics.LAYER_PLAYER, false);
     Physics2D.IgnoreLayerCollision(UserInterfaceGraphics.LAYER_ENEMY, UserInterfaceGraphics.LAYER_PLAYER, false);
 }