Наследование: MonoBehaviour
Пример #1
0
 public PlayGameInitData(
     BotEntity botEntityPrefab,
     BotEntity botEntityPrefab2P,
     CameraFollower cameraFollower,
     PlayerHpPresenter playerHpPresenter,
     TileMapInfo tileMapInfo,
     RunButtonEvent runButtonEvent,
     ScriptText scriptText,
     BulletEntity bulletPrefab,
     ErrorMsg errorMsg,
     SoundManager soundManager,
     MeleeAttackEntity meleeAttackPrefab,
     ProcessScrollViewPresenter processScrollViewPresenter,
     EventSystemWatcher eventSystemWatcher)
 {
     this.botEntityPrefab            = botEntityPrefab;
     this.botEntityPrefab2P          = botEntityPrefab2P;
     this.cameraFollower             = cameraFollower;
     this.playerHpPresenter          = playerHpPresenter;
     this.tileMapInfo                = tileMapInfo;
     this.runButtonEvent             = runButtonEvent;
     this.scriptText                 = scriptText;
     this.bulletPrefab               = bulletPrefab;
     this.errorMsg                   = errorMsg;
     this.soundManager               = soundManager;
     this.meleeAttackPrefab          = meleeAttackPrefab;
     this.processScrollViewPresenter = processScrollViewPresenter;
     this.eventSystemWatcher         = eventSystemWatcher;
 }
Пример #2
0
    /*CHANGE TO NEW BODY METHOD*/
    private void changeBody()
    {
        if (newBody != null)
        {
            CameraFollower cf = GameObject.FindObjectOfType <CameraFollower>();
            cf.target = newBody.transform;

            // Disable this body
            this.gameObject.tag = "Body";
            this.gameObject.GetComponent <Rigidbody2D>().velocity     = new Vector2(0, 0);
            this.gameObject.GetComponent <PlayerController>().enabled = false;
            this.gameObject.GetComponent <Animator>().Play("Desactivate");
            this.gameObject.GetComponent <ChangeBody>().enabled = false;
            this.transform.GetChild(2).gameObject.SetActive(false);
            this.gameObject.layer = 12;

            // Enable new body
            Debug.Log(newBody);
            newBody.tag = "Player";
            newBody.GetComponent <PlayerController>().enabled = true;
            newBody.GetComponent <Animator>().Play("Activate");
            newBody.GetComponent <ChangeBody>().enabled = true;
            newBody.transform.GetChild(2).gameObject.SetActive(true);
            newBody.gameObject.layer = 9;

            // When the changing body process is done the changingBody variable is set to false
            changingBody = false;
        }
    }
Пример #3
0
    protected override void CameraEffects(ref CameraFollower camFol, ref PlayerController ctrl)
    {
        if (ToPeakPercentComplete != 1)
        {
            camFol.positionOffset = Vector3.Lerp(Vector3.zero, ctrl.colInfo.PositionOffset, ToPeakPercentComplete);
            //Check if the player wants to do a spin vault
            spinVault = InputManager.GetInput("Grab") != 0;
            if (spinVault && Physics.Raycast(ctrl.transform.position + ctrl.direction.HozDirection * MoveDist, -ctrl.direction.HozDirection, out RaycastHit h, MoveDist))
            {
                ctrl.CheckDir      = -h.normal;
                ctrl.CheckDirRange = h.distance;
            }
        }
        else
        {
            camFol.positionOffset = Vector3.Lerp(Vector3.zero, ctrl.colInfo.PositionOffset, 1 - ToGroundPercentComplete);
            for (int i = 0; i < transitions.Length && spinVault; i++)
            {
                if (transitions[i] as SwitchVaultToLedgeGrab)
                {
                    ignoreTransition[i] = false;
                }
            }
        }

        if (spinVault && OverPercentComplete > 0.9f)
        {
            ctrl.ForceRotate((Mathf.Atan2(-ctrl.direction.HozDirection.x, -ctrl.direction.HozDirection.z) * Mathf.Rad2Deg) % 360);
        }
    }
Пример #4
0
 protected override void Awake()
 {
     base.Awake();
     _sprRender         = GetComponent <SpriteRenderer>();
     _canvas            = FindObjectOfType <CameraFollower>();
     _relativeTransform = transform;
 }
Пример #5
0
    void Init()
    {
        myTransform = transform;
        canMove     = true;

        canJumpAgain      = true;
        canSlideAgain     = true;
        canRollLeftAgain  = true;
        canRollRightAgain = true;

#if UNITY_EDITOR
        keyboardInput = ExtendedGameObject.SetComponent <Keyboard_Input>(gameObject);
#elif UNITY_ANDROID
        touchInput = ExtendedGameObject.SetComponent <TouchInput>(gameObject);
#endif

        anim = ExtendedGameObject.SetComponent <Animator>(gameObject);

        MainCameraGO = GameObject.Find("Main Camera");
        if (MainCameraGO == null)
        {
            Debug.Log("Cant find main camera");
            return;
        }
        cameraFollower = ExtendedGameObject.SetComponent <CameraFollower>(MainCameraGO);
        cameraFollower.followTarget = gameObject.transform;

        capCollider = ExtendedGameObject.SetComponent <CapsuleCollider>(gameObject);
        base.Init();

        MakeUninvisible();

        didInit = true;
    }
 void Start()
 {
     input     = ReInput.players.GetPlayer(0);
     tpc       = this.gameObject.GetComponent <TPC> ();
     camF      = cam.gameObject.GetComponent <CameraFollower> ();
     fovlerper = 50f;
 }
Пример #7
0
        public PlayerBotController(BotEntity botEntityPrefab, TileMapInfo tileMapInfo, BulletEntity bulletPrefab,
                                   CameraFollower cameraFollower, PlayerHpPresenter playerHpPresenter, RunButtonEvent runButtonEvent,
                                   ScriptText scriptText, ErrorMsg errorMsg, SoundManager soundManager, MeleeAttackEntity meleeAttackEntity,
                                   ProcessScrollViewPresenter processScrollViewPresenter, EventSystemWatcher eventSystemWatcher)
        {
            this.errorMsg          = errorMsg;
            this.playerHpPresenter = playerHpPresenter;
            var botEntity = Object.Instantiate(botEntityPrefab);

            tileMapInfo.PlayerTankTransform = botEntity.transform;
            botEntity.gameObject.layer      = LayerMask.NameToLayer("PlayerBot");
            cameraFollower.SetPlayerPosition(botEntity.transform);
            var botEntityAnimation = botEntity.GetComponent <BotEntityAnimation>();

            botEntity.transform.position = tileMapInfo.GetPlayer1StartPosition();
            MeleeAttackApplication meleeAttackApplication = new MeleeAttackApplication(meleeAttackEntity, soundManager);
            var gun = new Gun(
                soundManager,
                new BulletEntityCreator(bulletPrefab, LayerMask.NameToLayer("PlayerBullet")),
                false
                );

            botApplication = new BotApplication.BotApplication(
                botEntity, botEntityAnimation, tileMapInfo, eventSystemWatcher, gun, meleeAttackApplication
                );

            javaScriptEngine = new JavaScriptEngine.JavaScriptEngine(botApplication);
            runButtonEvent.AddClickEvent(() => OnRunButtonClick(processScrollViewPresenter, scriptText));
        }
Пример #8
0
    //enum QualityOptions { low, medium, best};

    void Start()
    {
        camF          = Camera.main.GetComponent <CameraFollower>();
        qualityint    = 4;
        changeoption  = 1;
        togglequality = 5;
    }
Пример #9
0
        public IEnumerator Camera_Move_With_Position_Offset()
        {
            GameObject     camera  = CreateCamera();
            Vector3        initPos = camera.transform.position;
            CameraFollower cf      = camera.GetComponent <CameraFollower>();

            cf.positionOffset = new Vector3(10, 5, -7);

            yield return(null);

            Debug.Assert(camera.transform.position == initPos);

            GameObject target = new GameObject();

            target.transform.position = new Vector3(-5, 6, 0);
            cf.target = target;

            yield return(null);

            Debug.Assert(camera.transform.position == target.transform.position + cf.positionOffset);
            //Repeat the check to ensure the position is consistent among frames
            yield return(null);

            Debug.Assert(camera.transform.position == target.transform.position + cf.positionOffset);
        }
Пример #10
0
 void Start()
 {
     SetAnimator(smallAnimator);
     currAnimator.SetAnimation("Idle", true);
     follower  = Camera.main.GetComponent <CameraFollower> ();
     startPlay = Time.time;
 }
Пример #11
0
    private bool changedSpeed;                                                  //Is set to true after useSpeed is set to zero and the text has been 'skipped'


    void Start()
    {
        gPI = GameObject.FindWithTag("Handler").GetComponent <GamePadInputs> ();
        tPC = GameObject.FindWithTag("Player").GetComponent <ThirdPersonController> ();

        if (Camera.main != null)
        {
            cam  = Camera.main;
            camF = cam.GetComponent <CameraFollower> ();
        }
        currentPage = 0;
        if (textSpeed < 0)
        {
            textSpeed = 0f;
        }

        RefreshValues();
        currentPage = 0;

        canInteract      = true;
        organizedReplies = false;
        changedSpeed     = true;

        textBoxGUIPos.gameObject.SetActive(false);
        replyButtonsPosition.gameObject.SetActive(false);

        prompt = Instantiate(buttonPrompt) as GameObject;
        prompt.transform.SetParent(this.transform.parent);
        prompt.transform.position = this.transform.position + Vector3.up * 1.6f;
        prompt.gameObject.SetActive(false);
    }
 // Use this for initialization
 void Start()
 {
     camFollower = GameObject.Find ("Main Camera").GetComponent<CameraFollower> ();
     playerCenterPoint = Camera.main.WorldToScreenPoint(camFollower.playerCenter);
     counterGraphic = (Texture2D) Resources.Load ("counterGraphic");
     float scaleFactor = (Screen.width * counterGraphicScale) / (float)counterGraphic.width;
     graphicHeight = counterGraphic.height * scaleFactor;
     graphicWidth = counterGraphic.width * scaleFactor;
 }
Пример #13
0
    // Use this for initialization
    void Start()
    {
        GameObject playerObj = GameObject.Find("Player");

        player = playerObj.GetComponent <PlayerScript>();

        GameObject cameraBaseObj = GameObject.Find("CameraBase");

        cameraBase = cameraBaseObj.GetComponent <CameraFollower>();
    }
Пример #14
0
 public void SetControlledBeeSwarm(BeeSwarm bees)
 {
     controlling = bees;
     controller  = bees.GetComponent <CharacterController>();
     if (cameraFollower == null)
     {
         cameraFollower = GetComponent <CameraFollower>();
     }
     cameraFollower.target = bees.cameraTarget;
 }
    IEnumerator PlayCutscene()
    {
        yield return(new WaitForSeconds(3f));

        GameObject.FindWithTag("Pause").transform.Find("Bars").GetComponent <Animator>().SetBool("barsToggle", true);

        tpc  = PlayerManager.GetMainPlayer();
        camF = tpc.cam.GetComponent <CameraFollower>();

        tpc.disableControl = true;
        tpc.rb.isKinematic = true;
        tpc.inCutscene     = true;

        camF.disableControl = true;
        Vector3    origPos = camF.transform.position;
        Quaternion origRot = camF.transform.rotation;

        if (cameraPosition == null)
        {
            camF.transform.position = barrier.transform.position - (barrier.transform.forward * 8f) + (Vector3.up * 6f);
            camF.transform.LookAt(barrier.transform);
        }
        else
        {
            camF.transform.position = cameraPosition.transform.position;
            camF.transform.rotation = cameraPosition.transform.rotation;
        }
        this.GetComponent <AudioSource>().Play();
        yield return(new WaitForSeconds(0.8f));

        pfxEM.enabled = true;
        pfx.GetComponent <ParticleSystem>().Play();
        StartCoroutine(tpc.DeactivateParticle(pfx, pfxEM));
        yield return(null);

        barrier.SetActive(false);
        if (protectedCollider)
        {
            protectedCollider.enabled = true;
        }

        GameObject.FindWithTag("Pause").transform.Find("Bars").GetComponent <Animator>().SetBool("barsToggle", false);

        for (int f = 0; f <= 60; f++)
        {
            camF.transform.position = Vector3.Lerp(camF.transform.position, origPos, f / 60f);
            camF.transform.rotation = Quaternion.Lerp(camF.transform.rotation, origRot, f / 60f);
            yield return(null);
        }

        tpc.disableControl  = false;
        tpc.rb.isKinematic  = false;
        tpc.inCutscene      = false;
        camF.disableControl = false;
    }
Пример #16
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        EditorGUILayout.HelpBox("camera will follow target", MessageType.Info);

        if (GUILayout.Button("set offset"))
        {
            CameraFollower cameraFollower = (CameraFollower)target;
            cameraFollower.offset = cameraFollower.transform.position - cameraFollower.target.position;
        }
    }
Пример #17
0
    public void AddPlayer(PlayerControl p)
    {
        m_player = p;
        m_allEntities.Add(p);

        CameraFollower cf = Camera.main.GetComponent <CameraFollower>();

        if (cf != null)
        {
            cf.m_target = m_player.transform;
        }
    }
Пример #18
0
 static void DrawGizmosSelected(CameraFollower follower, GizmoType gizmoType)
 {
     if (follower.showGizmos)
     {
         Vector3 target = follower.target.position;
         Vector3 cur    = follower.transform.position;
         Handles.DrawDottedLine(cur, target, 3);
         Gizmos.DrawWireSphere(target, 0.125f);
         float distance = (target - cur).magnitude;
         Handles.Label((cur - target) / 2, "distance : " + distance);
     }
 }
Пример #19
0
 void Start()
 {
     SprintSpeed = Speed * 2f;
     honk        = transform.Find("Honk").gameObject;
     audio       = GetComponent <AudioSource>();
     feetAudio   = transform.Find("feetSound").GetComponent <AudioSource>();
     honk.SetActive(false);
     nearBabies       = new HashSet <BabyDuckController>();
     cameraFollower   = Camera.main.GetComponent <CameraFollower>();
     _body.useGravity = false;
     resetDuckAlignment();
     animator    = gameObject.GetComponent <Animator>();
     gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
 }
Пример #20
0
    private void Awake()
    {
        //Singleton
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        enabled = false;
    }
Пример #21
0
 private void Awake()
 {
     //Singleton creation
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     cameraTransform = this.transform;
     target          = GameObject.FindGameObjectWithTag("Player").transform;
 }
Пример #22
0
        private void InitPlayer()
        {
            var playerRecord = ScriptableUtils.GetCurrentPlayerRecord();
            var commonRecord = ScriptableUtils.GetCommonElements();

            _view = Object.Instantiate(playerRecord.PlayerPrefab);
            _view.ModelUpdate(_model);
            var rigidbody = _view.GetComponent <Rigidbody>();

            InitMoveComponent(rigidbody);

            _cameraFollower = Object.Instantiate(commonRecord.Camera);
            _cameraFollower.Init(_view.transform);

            EventHolder <GameEventType> .Dispatcher.Broadcast(GameEventType.WeaponSwap, _model.CurrentWeapon());
        }
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player" && other.gameObject.name == "Woodle Character")
     {
         camera = PlayerManager.GetMainPlayer().cam;
         camF   = camera.GetComponent <CameraFollower>();
         if (camF != null)
         {
             if (camF.stationaryMode1 || camF.stationaryMode2)
             {
                 camF.ExitCameraCut();
                 //    camera.transform.eulerAngles = new Vector3(camera.transform.eulerAngles.x, cameraYAngle, camera.transform.eulerAngles.z);
             }
         }
     }
 }
Пример #24
0
 public void SetControllable(PlayerControllable controllable)
 {
     controlling = controllable;
     controller  = controllable.GetComponent <CharacterController>();
     if (cameraFollower == null)
     {
         cameraFollower = GetComponent <CameraFollower>();
     }
     cameraFollower.target = controllable.cameraTarget;
     cameraTransform       = controllable.cameraTarget.transform;
     playerStats           = controllable.playerStats;
     if (OnControllableChange != null)
     {
         OnControllableChange(controllable);
     }
 }
    IEnumerator AutoExit()
    {
        yield return(new WaitForSeconds(temporaryDuration));

        this.gameObject.GetComponent <BoxCollider> ().enabled = false;
        ExitThis();
        CameraFollower camF = GameObject.FindWithTag("MainCamera").gameObject.GetComponent <CameraFollower> ();

        if (camF.stationaryMode1 || camF.stationaryMode2)
        {
            camF.ExitCameraCut();
            if (GetComponent <Camera>() != null)
            {
                GetComponent <Camera>().transform.eulerAngles = new Vector3(GetComponent <Camera>().transform.eulerAngles.x, 0f, GetComponent <Camera>().transform.eulerAngles.z);
            }
        }
    }
Пример #26
0
    public GameObject CreatePlayer(int userID, int entityID, Vector3 pos, Quaternion quat, bool actor)
    {
        GameObject       obj = null;
        EntityAttributes ea  = null;

        //Other players
        if (actor != true)
        {
            obj = Instantiate(otherplayer, pos, quat);

            ea = obj.GetComponent <EntityAttributes>();

            ea.ID = userID;
            ea.ID = entityID;

            if (playerArray.ContainsKey(ea.ID) == true)
            {
                Destroy(playerArray[ea.ID]);
                playerArray.Remove(ea.ID);
            }


            playerArray.Add(ea.ID, obj);

            return(obj);
        }

        // Current player
        obj = Instantiate(player, pos, quat);

        ea          = obj.GetComponent <EntityAttributes>();
        ea.ID       = userID;
        ea.EntityID = entityID;

        CameraFollower cam = Camera.main.GetComponent <CameraFollower>();

        if (cam != null)
        {
            cam.SetCameraPosition(obj.transform.position);
            cam.target = obj.transform;
            cam.SetOffset();
        }

        playerArray.Add(ea.ID, obj);
        return(obj);
    }
Пример #27
0
 void Awake()
 {
     fader           = GameObject.Find("Fader").GetComponent <ScreenFader> ();
     temp            = GameObject.Find("Player");
     playerCollider  = temp.GetComponent <BoxCollider2D> ();
     playerHealth    = temp.GetComponent <PlayerHealth> ();
     cameraBoundries = GameObject.FindWithTag("MainCamera").GetComponent <CameraFollower> ();
     pathPoints      = GameObject.Find("ClownGirlWayPoints").GetComponentsInChildren <Transform> ();
     startPos        = GameObject.Find("LineCastStart").GetComponent <Transform>();
     endPos          = GameObject.Find("LineCastEnd").GetComponent <Transform> ();
     textManager     = GameObject.Find("TextCanvas").GetComponent <TextManager> ();
     playerFinder    = GameObject.Find("PlayerFinder").GetComponent <Transform> ();
     trigger4        = GameObject.Find("Trigger4").GetComponent <Transform> ();
     spawnpoint2     = GameObject.FindGameObjectWithTag("HelicopterSpawnPoint").GetComponent <Transform>();
     textManager.RoundStarting();
     fader.gameStarting = true;
 }
    void OnTriggerEnter(Collider other)
    {
        if (!insideThisTrigger && other.gameObject == PlayerManager.GetMainPlayer().gameObject&& !PlayerManager.GetMainPlayer().challengeWarping&& !PlayerManager.GetMainPlayer().disableControl&& (entTrig == null || entTrig.isInsideThis))
        {
            //     if (level == "Level5")
            //       Debug.Log("ENTER LEVEL LOAD");

            if (entTrig)
            {
                entTrig.keepOn = true;
            }

            tpc = other.gameObject.GetComponent <TPC>();
            //    tpc.ps.ShowLevelTitle(level);

            if (!SceneManager.GetSceneByName(level).isLoaded)
            {
                tpcBeaver = PlayerManager.GetPlayer(1);
                cam       = tpc.cam.GetComponent <CameraFollower>();
                StartCoroutine(Loadinglevel());
            }
            else
            {
                if (fullSceneObject == null)
                {
                    FindFullLevel();
                }
                if (fullSceneObject != null)
                {
                    odm.ActivateObject(fullSceneObject);
                }

                StartCoroutine("WaitToDeact");
                //   if (noncolliderzone != null)
                //       odm.DeactivateObject(noncolliderzone, null);
            }

            /*    if (lptCollider != null)
             *  {
             *      lptCollider.gameObject.SetActive(false);
             *      lptCollider.enabled = true;
             *      lptCollider.gameObject.SetActive(true);
             *  }*/
        }
    }
Пример #29
0
 // Setup singleton
 void Awake()
 {
     if (i == null)
     {
         i = this;
     }
     else
     {
         Debug.LogError("There should only be 1 PlayerController in the scene!");
     }
     // Convert action register to dictionary for performance
     actionRegister = new Dictionary <string, ControllerAction>();
     foreach (ControllerActionSerialized cas in actionRegisterSerialized)
     {
         actionRegister.Add(cas.input, cas.actions);
     }
     cameraFollower = GetComponent <CameraFollower>();
 }
        public ClientBotController(BotEntity botEntityPrefab, TileMapInfo tileMapInfo, BulletEntity bulletPrefab,
                                   CameraFollower cameraFollower, PlayerHpPresenter playerHpPresenter, RunButtonEvent runButtonEvent,
                                   ScriptText scriptText, ErrorMsg errorMsg, SoundManager soundManager,
                                   GameSignalingClient gameSignalingClient,
                                   MeleeAttackEntity meleeAttackEntity, ProcessScrollViewPresenter processScrollViewPresenter,
                                   EventSystemWatcher eventSystemWatcher)
        {
            this.errorMsg          = errorMsg;
            this.playerHpPresenter = playerHpPresenter;
            var botEntity = Object.Instantiate(botEntityPrefab);

            tileMapInfo.PlayerTankTransform = botEntity.transform;
            botEntity.gameObject.layer      = LayerMask.NameToLayer("PlayerBot");
            cameraFollower.SetPlayerPosition(botEntity.transform);
            var botEntityAnimation = botEntity.GetComponent <BotEntityAnimation>();

            botEntity.transform.position = tileMapInfo.GetPlayer2StartPosition();
            MeleeAttackApplication meleeAttackApplication = new MeleeAttackApplication(meleeAttackEntity, soundManager);
            var gun = new Gun(
                soundManager,
                new BulletEntityCreator(bulletPrefab, LayerMask.NameToLayer("PlayerBullet")),
                false
                );

            botApplication = new BotApplication.BotApplication(
                botEntity, botEntityAnimation, tileMapInfo, eventSystemWatcher, gun,
                meleeAttackApplication, true
                );
            var hookBotApplication = new ClientBotCommandsHook(botApplication, gameSignalingClient);

            javaScriptEngine = new JavaScriptEngine.JavaScriptEngine(hookBotApplication);
            runButtonEvent.AddClickEvent(async() =>
            {
                var tokenSource = new CancellationTokenSource();
                var token       = tokenSource.Token;
                var panel       =
                    processScrollViewPresenter.AddProcessPanel(
                        () => { tokenSource.Cancel(); });
                var task = javaScriptEngine.ExecuteJS(scriptText.GetScriptText(), token, panel.ProcessId);
                await task;
                panel.Dispose();
            });
        }
Пример #31
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player" && other.gameObject.name == "Woodle Character")
        {
            camF = PlayerManager.GetMainPlayer().cam.GetComponent <CameraFollower>();

            if (camF != null && camF.currentCutID != iD)
            {
                camF.currentCutID = iD;
                camF.cutHAngle    = horizontalMovement;
                camF.cutVAngle    = verticalMovement;
                if (!canMoveCamera)
                {
                    camF.cutFarDist = maxCharacterDistFOV;
                }
                camF.EnterCameraCut(cameraCutPosition, !canMoveCamera, transitionToCut, cameraFollowsCharacter);
            }
        }
    }
Пример #32
0
 // Use this for initialization
 void Start()
 {
     rend = GetComponent <Renderer> ();
     live_material = GetComponent<Renderer>().material;
     GameObject [] objects = GameObject.FindGameObjectsWithTag ("PrimeNode");
     primeNode =  (objects != null && objects.Length > 0) ? (PathNode)objects[0].GetComponent<PathNode> () : null;
     cameraFollower = (CameraFollower)GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraFollower> ();
     score = (Score)GameObject.FindGameObjectWithTag ("Score").GetComponent<Score> ();
     Reset ();
 }
Пример #33
0
 // Use this for initialization
 void Start()
 {
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
     isMobile = Application.isMobilePlatform;
     lives = (Lives)GameObject.FindGameObjectWithTag ("Lives").GetComponent<Lives>();
     score = (Score)GameObject.FindGameObjectWithTag ("Score").GetComponent<Score> ();
     cameraFollower = (CameraFollower)GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraFollower> ();
     Restart ();
     dot_count = GameObject.FindGameObjectsWithTag ("Dot").Length;
 }