Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        igs = Engine.GetComponent<InGameScript>();

        switch((int)transform.position.x){
            case 0:
                state = "left";
                associatedKeyCode1 = DataManager.Instance.KeyCodeLeft;
                associatedKeyCode2 = DataManager.Instance.SecondaryKeyCodeLeft;
                this.pm = igs.StartParticleMineLeft;
                break;
            case 2:
                state = "down";
                associatedKeyCode1 = DataManager.Instance.KeyCodeDown;
                associatedKeyCode2 = DataManager.Instance.SecondaryKeyCodeDown;
                this.pm = igs.StartParticleMineDown;
                break;
            case 4:
                state = "up";
                associatedKeyCode1 = DataManager.Instance.KeyCodeUp;
                associatedKeyCode2 = DataManager.Instance.SecondaryKeyCodeUp;
                this.pm = igs.StartParticleMineUp;
                break;
            case 6:
                state = "right";
                associatedKeyCode1 = DataManager.Instance.KeyCodeRight;
                associatedKeyCode2 = DataManager.Instance.SecondaryKeyCodeRight;
                this.pm = igs.StartParticleMineRight;
                break;
        }
        missed = false;
    }
    private Transform tHUDPUMeterBar; //the bar in the powerup meter on HUD

    void Start()
    {
        tPlayer = transform;

        //powerup meter visual
        tHUDPUMeter    = GameObject.Find("HUDMainGroup/HUDPUMeter").GetComponent <Transform>() as Transform;
        tHUDPUMeterBar = GameObject.Find("HUDMainGroup/HUDPUMeter/HUD_PU_Meter_Bar_Parent").GetComponent <Transform>() as Transform;

        iPowerupCount = System.Enum.GetNames(typeof(PowerUps)).Length - 1; //PowerUps.GetValues(PowerUps).Length-1;//get the total number of powerups

        bPowerupStatus        = new bool[iPowerupCount];
        fPowerupStartTime     = new float[iPowerupCount];
        fPowerupTotalDuration = new float[iPowerupCount];

        hInGameScript     = this.GetComponent <InGameScript>() as InGameScript;
        hControllerScript = this.GetComponent <ControllerScript>() as ControllerScript;
        hSoundManager     = GameObject.Find("SoundManager").GetComponent <SoundManager>() as SoundManager;

        tHUDPUMeter.transform.position -= new Vector3(0, 100, 0); //hide the powerup meter
        fMagnetismDefaultRadius         = 200;
        fMangetismRadius = 200;                                   //default: pull currency toward the character
        iCurrencyUnits   = 0;

        for (int i = 0; i < iPowerupCount; i++)
        {
            bPowerupStatus[i]        = false;
            fPowerupTotalDuration[i] = 10.0f;    //active time duration of the powerups
        }
    }
Esempio n. 3
0
    void Start()
    {
        tPlayer = GameObject.Find("Player").transform;

        hInGameScript           = GameObject.Find("Player").GetComponent <InGameScript>() as InGameScript;
        hPowerupsMainController = GameObject.Find("Player").GetComponent <PowerupsMainController>() as PowerupsMainController;
    }
    void Start()
    {
        bFrontColliderFlag = true;

        hPlayerSidesColliderScript = GameObject.Find("PlayerSidesCollider").GetComponent <PlayerSidesColliderScript>() as PlayerSidesColliderScript;
        hInGameScript = GameObject.Find("Player").GetComponent <InGameScript>() as InGameScript;
    }
Esempio n. 5
0
    void Start()
    {
        tPlayer          = GameObject.Find("Player").transform;
        bPitFallingStart = false;

        hInGameScript     = this.GetComponent <InGameScript>() as InGameScript;
        hControllerScript = this.GetComponent <ControllerScript>() as ControllerScript;
    }
    void Start()
    {
        tPlayer = GameObject.Find("Player").transform;
        tEnemy  = this.transform;

        hInGameScript     = GameObject.Find("Player").GetComponent <InGameScript>() as InGameScript;
        hControllerScript = GameObject.Find("Player").GetComponent <ControllerScript>() as ControllerScript;
        hSoundManager     = GameObject.Find("SoundManager").GetComponent <SoundManager>() as SoundManager;
    }
Esempio n. 7
0
    void Start()
    {
        WaypointAngle   = 0.0f;
        fPathLength     = defaultPathLength;
        fNextPathLength = defaultPathLength;
        CurrentPercent  = 0.0f;

        hInGameScript      = this.GetComponent <InGameScript>() as InGameScript;
        hControllerScript  = this.GetComponent <ControllerScript>() as ControllerScript;
        hPatchesRandomizer = this.GetComponent <PatchesRandomizer>() as PatchesRandomizer;
        hElementsGenerator = this.GetComponent <ElementsGenerator>() as ElementsGenerator;
    }
Esempio n. 8
0
    private float fCamShakeImpulse = 0.0f;  //Camera Shake Impulse

    void Start()
    {
        tCamera     = Camera.main.transform;
        tPlayerMesh = GameObject.Find("PlayerRotation/PlayerMesh").transform;
        tPlayer     = GameObject.Find("Player").transform;

        hInGameScript     = GameObject.Find("Player").GetComponent <InGameScript>() as InGameScript;
        hControllerScript = GameObject.Find("Player").GetComponent <ControllerScript>() as ControllerScript;

        fCameraRotationX = tCamera.localEulerAngles.x;
        fCameraRotationZ = tCamera.localEulerAngles.z;

        iCameraState     = 0;
        fCamShakeImpulse = 0.0f;
    }
Esempio n. 9
0
    void Start()
    {
        hControllerScript = GameObject.Find("Player").GetComponent <ControllerScript>() as ControllerScript;
        hInGameScript     = GameObject.Find("Player").GetComponent <InGameScript>() as InGameScript;
        hControllerScript = GameObject.Find("Player").GetComponent <ControllerScript>() as ControllerScript;

        stopAllSounds();

        if (bMusicEnabled == true)
        {
            asMusic[0].Play();
        }
        else
        {
            asMusic[0].Stop();
        }
    }
    void Start()
    {
        iCurrentPNum           = 1;
        fPreviousTotalDistance = 0.0f;

        hInGameScript      = this.GetComponent <InGameScript>() as InGameScript;
        hCheckPointsMain   = GetComponent <CheckPointsMain>() as CheckPointsMain;
        hElementsGenerator = this.GetComponent <ElementsGenerator>() as ElementsGenerator;

        instantiateStartPatch();
        goPreviousPatch = goCurrentPatch;

        tPlayer = GameObject.Find("Player").transform;
        hCheckPointsMain.setChildGroups();

        hCheckPointsMain.SetCurrentPatchCPs();
        hCheckPointsMain.SetNextPatchCPs();
    }
Esempio n. 11
0
    void Start()
    {
        tPlayer                 = GameObject.Find("Player").transform;
        hInGameScript           = GameObject.Find("Player").GetComponent <InGameScript>() as InGameScript;
        hControllerScript       = GameObject.Find("Player").GetComponent <ControllerScript>() as ControllerScript;
        hPowerupsMainController = GameObject.Find("Player").GetComponent <PowerupsMainController>() as PowerupsMainController;

        tmHUDCurrencyText = GameObject.Find("HUDMainGroup/HUDGroup/HUDCurrencyGroup/HUD_Currency_Text").GetComponent <TextMesh>() as TextMesh;
        tmHUDScoreText    = GameObject.Find("HUDMainGroup/HUDGroup/HUDScoreGroup/HUD_Score_Text").GetComponent <TextMesh>() as TextMesh;
        tmHUDTimerText    = GameObject.Find("HUDMainGroup/HUDGroup/HUDTimer/HUD_Timer_Text").GetComponent <TextMesh>() as TextMesh;

        tHUDScoreContainerMid    = GameObject.Find("HUDMainGroup/HUDGroup/HUDScoreGroup/HUD_Score_BG").GetComponent <Transform>() as Transform;         //	HUD Score Container
        tHUDCurrencyContainerMid = GameObject.Find("HUDMainGroup/HUDGroup/HUDCurrencyGroup/HUD_Currency_BG").GetComponent <Transform>() as Transform;   //	HUD Currency Container

        tHUDTimer = GameObject.Find("HUDMainGroup/HUDGroup/HUDTimer/HUD_Timer_Text").GetComponent <MeshRenderer>();

        HUDTimerBg = GameObject.Find("HUDMainGroup/HUDGroup/HUDTimer/HUD_Timer_BG/HUD_Score_BG_Mid").GetComponent <MeshRenderer>();

        if (!PersistentManagerScript.Instance.showTimer)
        {
            tHUDTimer.enabled = false;
            tmHUDTimerText.GetComponent <MeshRenderer>().enabled = false;
            HUDTimerBg.enabled = false;
        }

        //get time difference to calculate score

        fCurrentTime  = Time.time;
        fPreviousTime = Time.time;

        fPreviousDistance = 0;
        fCurrentDistance  = 0;
        fCurrentTime      = 0;
        fPreviousTime     = 0;

        iDivisorScore      = 10;
        iDivisorCurrency   = 10;
        iDivisorMultiplier = 10;
    }
Esempio n. 12
0
    // Use this for initialization
    void Start()
    {
        igs = Engine.GetComponent<InGameScript>();

        switch((int)transform.position.x){
            case 0:
                state = ArrowPosition.LEFT;
                break;
            case 2:
                state = ArrowPosition.DOWN;
                break;
            case 4:
                state = ArrowPosition.UP;
                break;
            case 6:
                state = ArrowPosition.RIGHT;
                break;
        }
        missed = false;
        valid = false;
        alreadyScored = false;
        precWayoff = DataManager.Instance.PrecisionValues[Precision.WAYOFF];
    }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        igs = Engine.GetComponent<InGameScript>();

        switch((int)transform.position.x){
            case 0:
                state = "left";
                break;
            case 2:
                state = "down";
                break;
            case 4:
                state = "up";
                break;
            case 6:
                state = "right";
                break;
        }
        missed = false;
        valid = false;
        alreadyScored = false;
        precWayoff = DataManager.Instance.PrecisionValues[Precision.WAYOFF];
    }
Esempio n. 14
0
 void Start()
 {
     GameManager = GetComponentInParent <InGameScript>();
     originPos   = inner.transform.position;
 }
    void Start()
    {
        hMenuScript                = GameObject.Find("MenuGroup").GetComponent <MenuScript>() as MenuScript;
        hPatchesRandomizer         = this.GetComponent <PatchesRandomizer>() as PatchesRandomizer;
        hPlayerSidesColliderScript = GameObject.Find("PlayerSidesCollider").GetComponent <PlayerSidesColliderScript>() as PlayerSidesColliderScript;
        hPlayerFrontColliderScript = GameObject.Find("PlayerFrontCollider").GetComponent <PlayerFrontColliderScript>() as PlayerFrontColliderScript;
        hSoundManager              = GameObject.Find("SoundManager").GetComponent <SoundManager>() as SoundManager;
        hInGameScript              = this.GetComponent <InGameScript>() as InGameScript;
        hPitsMainController        = this.GetComponent <PitsMainController>() as PitsMainController;
        hCheckPointsMain           = this.GetComponent <CheckPointsMain>() as CheckPointsMain;
        hPowerupScript             = this.GetComponent <PowerupsMainController>() as PowerupsMainController;
        hEnemyController           = GameObject.Find("Enemy").GetComponent <EnemyController>() as EnemyController;
        hPowerupScript             = this.GetComponent <PowerupsMainController>() as PowerupsMainController;
        hCameraController          = Camera.main.gameObject.GetComponent <CameraController>() as CameraController;
        swipeLogic = transform.GetComponent <SwipeControls>() as SwipeControls;

        tPlayer         = transform;
        tPlayerRotation = transform.Find("PlayerRotation");
        playerRenderer  = GameObject.Find("rend").GetComponent <SkinnedMeshRenderer>();

        //get the animation component of the player character
        aPlayer          = this.transform.Find("PlayerRotation/PlayerMesh/Prisoner").GetComponent <Animation>() as Animation;
        tBlobShadowPlane = transform.Find("BlobShadowPlane");

        tPlayerSidesCollider = GameObject.Find("PlayerSidesCollider").transform;
        tFrontCollider       = GameObject.Find("PlayerFrontCollider").transform;
        if (!PersistentManagerScript.Instance.obstacles)
        {
            tFrontCollider.GetComponent <BoxCollider>().enabled       = false;
            tPlayerSidesCollider.GetComponent <BoxCollider>().enabled = false;
        }

        tHUDGroup    = GameObject.Find("HUDMainGroup/HUDGroup").transform;
        tPauseButton = GameObject.Find("HUDMainGroup/HUDGroup/HUDPause").transform;
        tQuitButton  = GameObject.Find("HUDMainGroup/HUDGroup/HUDQuit").transform;
        tQuitButton.gameObject.active = false;

        HUDCamera = GameObject.Find("HUDCamera").GetComponent <Camera>();

        v3BNCDefaultScale = tFrontCollider.localScale;
        v3BFCDefaultScale = tPlayerSidesCollider.localScale;

        bInAir = false;
        fCurrentDistanceOnPath = 50.0f;         //inital distance with respect to spline
        fCurrentDistance       = 0.0f;
        fCurrentMileage        = 0.0f;
        tCurrentAngle          = 0.0f;
        fPitFallLerpValue      = 0.0f;
        fPitFallForwardSpeed   = 0.0f;
        fPitPositionX          = 0.0f;
        iDeathAnimStartTime    = 0;
        bGroundhit             = false;
        bJumpFlag = false;
        bInJump   = false;
        fCurrentUpwardVelocity = 0;
        fCurrentHeight         = 0;

        bDirectionQueueFlag = false;
        directionQueue      = SwipeControls.SwipeDirection.Null;
        iLanePosition       = 0;        //set current lane to mid
        fCurrentWalkSpeed   = fStartingWalkSpeed;


        if (PlayerPrefs.HasKey("ControlsType"))
        {
            swipeControlsEnabled = PlayerPrefs.GetInt("ControlsType") == 1 ? true : false;
        }
        else
        {
            PlayerPrefs.SetInt("ControlsType", (swipeControlsEnabled == true ? 1 : 0));
        }

        hSoundManager.stopSound(SoundManager.CharacterSounds.Footsteps);
        StartCoroutine("playIdleAnimations");        //start playing idle animations
    }
Esempio n. 16
0
    private TextMesh tmPauseCountdown;          //count down numbers after resume
    void Start()
    {
        HUDCamera           = GameObject.Find("HUDMainGroup/HUDCamera").GetComponent <Camera>() as Camera;
        hControllerScript   = GameObject.Find("Player").GetComponent <ControllerScript>() as ControllerScript;
        hSoundManagerScript = GameObject.Find("SoundManager").GetComponent <SoundManager>() as SoundManager;
        hInGameScript       = GameObject.Find("Player").GetComponent <InGameScript>() as InGameScript;

        //the fResolutionFactor can be used to adjust components according to screen size
        aspectRatio       = ((Screen.height * 1.0f) / (Screen.width * 1.0f) - 1.77f);
        fResolutionFactor = (43.0f * (aspectRatio));

        tMenuGroup      = GameObject.Find("MenuGroup").transform;
        tMenuTransforms = new Transform[System.Enum.GetValues(typeof(MenuIDs)).Length];

        //main menu initialization
        tMenuTransforms[(int)MenuIDs.MainMenu] = tMenuGroup.Find("MainMenu").GetComponent <Transform>() as Transform;
        tMainMenuButtons    = new Transform[iMainMenuButtonsCount];
        tMainMenuButtons[0] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_TapToPlay");
        tMainMenuButtons[1] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_Instructions");
        tMainMenuButtons[2] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_Settings");

        //pause menu initialization
        tMenuTransforms[(int)MenuIDs.PauseMenu] = tMenuGroup.Find("PauseMenu").GetComponent <Transform>() as Transform;
        tPauseButtons    = new Transform[iPauseButtonsCount];
        tPauseButtons[0] = tMenuTransforms[(int)MenuIDs.PauseMenu].Find("Buttons/Button_Back");
        tPauseButtons[1] = tMenuTransforms[(int)MenuIDs.PauseMenu].Find("Buttons/Button_Resume");

        //game over menu initialization
        tMenuTransforms[(int)MenuIDs.GameOverMenu] = tMenuGroup.Find("GameOver").GetComponent <Transform>() as Transform;
        tGameOverButtons    = new Transform[iGameOverButtonsCount];
        tGameOverButtons[0] = tMenuTransforms[(int)MenuIDs.GameOverMenu].Find("Buttons/Button_Back");

        //instructions menu initialization
        tMenuTransforms[(int)MenuIDs.InstructionsMenu] = tMenuGroup.Find("Instructions").GetComponent <Transform>() as Transform;
        tInstructionsButtons    = new Transform[iInstructionsButtonsCount];
        tInstructionsButtons[0] = tMenuTransforms[(int)MenuIDs.InstructionsMenu].Find("Buttons/Button_Back").GetComponent <Transform>() as Transform;

        //settings menu initialization
        tMenuTransforms[(int)MenuIDs.SettingsMenu] = tMenuGroup.Find("Settings").GetComponent <Transform>() as Transform;
        tSettingsButtons    = new Transform[iSettingsButtonsCount];
        tSettingsButtons[0] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Buttons/Button_Back");
        tSettingsButtons[1] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Swipe/RadioButton_Background").GetComponent <Transform>() as Transform;
        tSettingsButtons[2] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Gyro/RadioButton_Background").GetComponent <Transform>() as Transform;
        tSettingsButtons[3] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_ON/RadioButton_Background").GetComponent <Transform>() as Transform;
        tSettingsButtons[4] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_OFF/RadioButton_Background").GetComponent <Transform>() as Transform;
        tSettingsButtons[5] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_ON/RadioButton_Background").GetComponent <Transform>() as Transform;
        tSettingsButtons[6] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_OFF/RadioButton_Background").GetComponent <Transform>() as Transform;

        mrSwipeControls = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Swipe/RadioButton_Foreground").GetComponent <MeshRenderer>() as MeshRenderer;
        mrGyroControls  = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Gyro/RadioButton_Foreground").GetComponent <MeshRenderer>() as MeshRenderer;
        mrMusicON       = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_ON/RadioButton_Foreground").GetComponent <MeshRenderer>() as MeshRenderer;
        mrMusicOFF      = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_OFF/RadioButton_Foreground").GetComponent <MeshRenderer>() as MeshRenderer;
        mrSoundON       = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_ON/RadioButton_Foreground").GetComponent <MeshRenderer>() as MeshRenderer;
        mrSoundOFF      = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_OFF/RadioButton_Foreground").GetComponent <MeshRenderer>() as MeshRenderer;

        ///////HUD//////
        (GameObject.Find("HUDMainGroup/HUDPauseCounter").GetComponent <MeshRenderer>() as MeshRenderer).enabled = false;

        //set the HUD position according to the screen resolution
        //(GameObject.Find("HUDMainGroup/HUDGroup/HUDCurrencyGroup").GetComponent<Transform>() as Transform).transform.Translate(fResolutionFactor,0,0);
        //(GameObject.Find("HUDMainGroup/HUDGroup/HUDScoreGroup").GetComponent<Transform>() as Transform).transform.Translate(-fResolutionFactor,0,0);
        //(GameObject.Find("HUDMainGroup/HUDGroup/HUDPause").GetComponent<Transform>() as Transform).transform.Translate(fResolutionFactor,0,0);
        //(GameObject.Find("HUDMainGroup/HUDGroup/HUDQuit").GetComponent<Transform>() as Transform).transform.Translate(fResolutionFactor,0,0);

        StartCoroutine(ShowMenu((int)MenuIDs.MainMenu));                        //show Main Menu on game launch
    }