示例#1
0
 // Start
 void Start()
 {
     m_Shadow       = GetComponent <ShadowCharacter>();
     m_PlayerObject = GameObject.FindGameObjectWithTag("Player");
     moveSum        = m_AttackChance + m_BlockChance + m_PowerUpChance;
     InitMovePool();
 }
示例#2
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;
    }
    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);
    }
示例#4
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;
    }