void OnBringIn()
    {
        Debug.LogError("ON BRING IN");

        //Turn off slow motion when the game over is brought in...
        ToyBox.GetPandora().SetSlowMotion(false);
    }
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 0.0f;



        //Set the current State
        currentState = LevelStates.Introduction;

        //suiosfa
        //gameRewards = Instantiate(gameRewards) as Rewards;

        //Create the stats.
        BreathlessStats = Instantiate(GameObjectTracker.instance._PlayerData.BlankStatistics) as Statistics;

        //SocialCenter.Instance.LoadLeaderboard("Highscore_PPS");
        //SocialCenter.Instance.ProcessLeaderboardScores();

        opentimer = 0.0f;

        //Start time.
        if (!ToyBox.GetPandora())
        {
            Debug.LogError("NO F TOYBOX!");
            return;
        }

        ToyBox.GetPandora().TimePaused = true;
        ToyBox.GetPandora().SceneBallStack.NumberBalls = 30;
        //started = true;
    }
    // Update is called once per frame
    void Update()
    {
        //Get the position of the joystick
        JoystickPosition   = ToyBox.GetPandora().Controls.JoystickScreenPosition;
        ThumbstickPosition = ToyBox.GetPandora().Controls.ThumbStickScreenPosition;
        InputPosition      = ToyBox.GetPandora().ForceVector;

        //Set the Sprite.
        transform.localPosition = JoystickPosition;
        //transform.position = JoystickPosition;


        //Calculate the angle of the thumbstick.
        //Transform band = Band.transform;

        if (thumbstickTransform.localPosition.x < 0)
        {
            band.rotation = Quaternion.AngleAxis(Angle, Vector3.forward);
        }
        else
        {
            band.rotation = Quaternion.AngleAxis(-Angle, Vector3.forward);
        }


        //Set the wdith of the band
        band.localScale = new Vector3(Width, Distance, 1.0f);

        float ratio = Width / MaxWidth;

        Band.color = Color.Lerp(TenseColor, RestColor, ratio);

        if (InputPosition != Vector3.zero && thumbstickTransform.localPosition == Vector3.zero)
        {
            Dpad.alpha = 1.0f;

            Vector3 dir = InputPosition - Vector3.zero;

            if (InputPosition.x > 0)
            {
                dpadTransform.rotation = Quaternion.AngleAxis(-InputAngle, Vector3.forward);
            }
            else
            {
                dpadTransform.rotation = Quaternion.AngleAxis(InputAngle, Vector3.forward);
            }

            //print(InputAngle);
        }
        else
        {
            Dpad.alpha = 0.0f;
        }



//		string message = string.Format("Angle : {0}, Distance: {1}, Wdith: {2} Touch:{3}",Angle,Distance,Width,ThumbstickPosition);
//		Debug.Log(message);
//
    }
    protected override void Start()
    {
        // Make sure to call parents base.
        base.Start();

        //Set the skull object to invisible.
        GameObject skull = transform.Find(DeathObjectName).gameObject;

        skull.GetComponent <Renderer>().enabled = false;

        GameObject ballspawner = transform.Find("BallSpawner").gameObject;

        startHealth    = Health;
        gamesBallStack = ToyBox.GetPandora().SceneBallStack;

        if (gamesBallStack == null)
        {
            Debug.LogError("No Ball Stack for CC");
        }
        else
        {
            //gamesBallStack.transform.parent = transform;
            gamesBallStack.transform.position = ballspawner.transform.position;
        }

        //Rset at start
        Reset();
    }
Example #5
0
    void ActivateNotification()
    {
        Notification.SetActive(true);

        NotiAnimation.Reset();

        IconIntro.Reset();
        IconIntro.Play(true);

        BGIntroA.Reset();
        BGIntroA.Play(true);

        BGIntro.Reset();
        BGIntro.Play(true);

        CounterAnimation.Reset();
        CounterAnimation.Play(true);


        NotiPop.Play();


        //Play sound effect.
        AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.LevelUp);

        ToyBox.GetPandora().SetSlowMotion(true);
    }
Example #6
0
 void Update()
 {
     if (isShielding)
     {
         ToyBox.GetPandora().Bot_01.ActivateDefense();
     }
 }
Example #7
0
    void CheckAlpha()
    {
        if (ToyBox.GetPandora().Bot_01.IsCannonAttached())
        {
            mySprite.alpha = alphaFaded;
            CannonBG.alpha = 0.0f;
        }
        else
        {
            mySprite.alpha = alphaVisible;
            CannonBG.alpha = alphaVisible;
        }
        if (_cannon == null)
        {
            mySprite.alpha = 0.0f;
            CannonBG.alpha = 0.0f;
            return;
        }
        if (_cannon.InUse || IconLocTarget == null || !_cannon.gameObject.activeSelf)
        {
            mySprite.alpha = 0.0f;
            CannonBG.alpha = 0.0f;
        }

        if (_cannon.IsBurning)
        {
            CannonOnFireSprite.gameObject.SetActive(true);
        }
        else
        {
            CannonOnFireSprite.gameObject.SetActive(false);
        }
    }
    public void DeleteAllData()
    {
        //Delete from the file system.
        FileFetch.ClearAllKeys();

        //Set the file version upon deleting.
        FileFetch.SetFloat("VERSION", FileVersion);

        //We have to delete the stats in memory.
        if (_gameStatistics)
        {
            DestroyObject(_gameStatistics.gameObject);
        }


        int index = 0;

        foreach (EntityFactory.CannonTypes type in _cannonSlots)
        {
            //Set to default cannons.
            ToyBox.GetPandora().AssignSlot(EntityFactory.CannonTypes.Zebra, index);

            index++;
        }


        LoadAllDataFromFileSystem();

        //Go through each card and recalculate the trophies earned

        //Recalculate trophies.
        CalculateTrophiesEarned();

        print("All Data Deleted :(((( ");
    }
Example #9
0
    void OnSlotsStart()
    {
        if (!started)
        {
            return;
        }


        ToyBox.GetPandora().TimePaused = false;
        ToyBox.GetPandora().SceneBallStack.NumberBalls = 30;


        //Display the Hud
        ActivityManager.Instance.TriggerTitleAnimation();


        ActivityManager.Instance.ToggleHud(true);

        //Pop this activity and spend slots.
        ActivityManager.Instance.PopActivity();


        GameObjectTracker.instance.vWorld.GotoNextRoom();
        //Resetback the animation?
    }
Example #10
0
    void NotificationIntroFinish()
    {
        //Revert back to normal time.

        NotiAnimation.Play(true);
        AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.PhasePresent);

        ToyBox.GetPandora().SetSlowMotion(false);
    }
Example #11
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (_local == null)
        {
            _local = ToyBox.GetPandora().CommandCenter_01;
        }


        PullToCenter(_local.gameObject, _local.GetComponent <Rigidbody>().mass);
    }
    public bool TogglePause(bool oPause = false)
    {
        if (oPause || ToyBox.GetPandora().TimePaused)
        {
            isPaused = true;
        }

        OnClick();
        return(isPaused);
    }
    public override void OnActivate()
    {
        //Just incase, we shuld always be 'closed' as we are actiavted. right?
        closed = true;


        //Calculate the ranges.
        DZRange = Deadzone_Max - Deadzone_Min;
        RangeR  = Range_Max - Range_Min;

        //Grab the joystick upon activate.
        _joystick = ToyBox.GetPandora().Controls;


        //Set the position of the joystick.
        JoystickPosition.localPosition = _joystick.JoystickScreenPosition;

        //Get the loaded controls to access
        loadedControls = controlsManager.LoadedControls;

        //Set the deadzone and the analog range.
        DeadZone.transform.localScale     = new Vector3(_joystick.DeadzoneRange.x, _joystick.DeadzoneRange.y, 1.0f);
        AnalogeRange.transform.localScale = new Vector3(_joystick.AnalogRange.x, _joystick.AnalogRange.y, 1.0f);


        //Load the adjusted values from here.
        ShieldButton.localPosition = loadedControls.Shield.localPosition;
        ShootButton.localPosition  = loadedControls.Shoot.localPosition;


        //Load values from controler and apply to the knobs.
        ShootKnob.transform.localPosition  = loadedControls.ShootButton.transform.localPosition;
        ShieldKnob.transform.localPosition = loadedControls.ShieldButton.transform.localPosition;

        ShootKnob.transform.localScale  = loadedControls.ShootButton.transform.localScale;
        ShieldKnob.transform.localScale = loadedControls.ShieldButton.transform.localScale;



        RValue  = _joystick.AnalogRange;
        DZValue = _joystick.DeadzoneRange;

        sliderRange.onValueChange    += OnRangeChange;
        sliderDeadzone.onValueChange += OnDeadzoneChange;

        closed = false;

        //Update the sliders to match.
        UpdateSliders();

        UpdateVisual();


        //	Debug.LogError("Finish Start");
    }
Example #14
0
 void OnPress(bool isDown)
 {
     if (isDown)
     {
         isShielding = true;
         AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Tap);
     }
     else
     {
         isShielding = false;
         ToyBox.GetPandora().Bot_01.DeactivateDefense();
     }
 }
Example #15
0
    void Awake()
    {
        //Check if GOT is null then create one.
        if (!GameObjectTracker.instance)
        {
            Instantiate(GOT);
        }

        if (!ToyBox.GetPandora())
        {
            Instantiate(Pandora);
        }
    }
Example #16
0
    void OnPress(bool isDown)
    {
        if (isDown)
        {
            ToyBox.GetPandora().Bot_01.Shoot();
            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Tap);

            LabelAmmoCount.transform.position = moveAmmoLabelTransform.position;
        }
        else
        {
            LabelAmmoCount.transform.position = this.transform.position;
        }
    }
Example #17
0
    void OnStartGame()
    {
        StartTween.Reset();
        StartTween.Play(true);

        //Apply the bank spending here...
        ToyBox.GetPandora().AssignCannonSlotTypes();


        //Play cash sound
        AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.CashRegister);

        started = true;
    }
    public void GotoHeavyRoom()
    {
        //We will make sure main game room is activate for testing
        GameRoom.SetActive(true);

        //turn off the boss room please
        BossRoom.SetActive(false);

        //set the heavy room to true.
        HeavyRoom.SetActive(true);
        ToyBox.GetPandora().SetSlowMotion(true, RoomChangeSpeed);
        GetComponent <Animation>()["TransitionHeavy"].speed = 1.0f;
        GetComponent <Animation>().Play("TransitionHeavy");
    }
    // Update is called once per frame
    void Update()
    {
        //Time.timeScale = 1.0f;

        if (GameOver)
        {
            GameOverView();
            return;
        }

        if (Die)
        {
            DieView();
            return;
        }

        //Follow the bot if we should.
        if (IsFollowingBot)
        {
            FollowBot();
        }
        else
        {
            LookAtObject();
        }


        // Here we do some checks if the bot has a cannon or not.

        if (PlayerToFollow)
        {
            if (!PlayerToFollow.IsCannonAttached())
            {
                transform.Rotate(transform.forward, rotation);
            }
        }

        if (isAnimatingCannonConnecting)
        {
            // we're in the middle of the attaching cannon animation.
            // we want to be updating our lookat to look at the cannon connector position
            // all other times we then want to do where ever the default game look at
            this.MyCamera.transform.LookAt(ToyBox.GetPandora().Bot_01.CannonPosition);
        }
        //Tilt the camera according to velocity.
    }
    // Update is called once per frame
    void Update()
    {
        ToyBox tb = ToyBox.GetPandora();

        if (tb != null)
        {
            //Get the data.
            int ballcount = tb.Bot_01.GetBallsInStorage();

            //Get the bot.
            Bot b = tb.Bot_01;

            if (b.IsCannonAttached() && Animal.alpha == 0.0f)
            {
                //Get the cannon icon and set it.
                Animal.spriteName = b.GetCannon().CannonTextureName;

                animalTween.Play(true);
            }

            if (!b.IsCannonAttached())
            {
                animalTween.Play(false);
            }


            //Write to the label.
            label.text = "" + ballcount + "";

            //Set the color to default
            label.color = originalColor;


            //If we reached max capacity
            if (tb.Bot_01.IsCannonFull())
            {
                label.color = FillColor;
            }

            if (ballcount <= 0)
            {
                label.color = EmptyColor;
            }
        }
    }
    // Use this for initialization
    protected override void Start()
    {
        // from Basic Enemy
        base.Start();

        objectAim = ToyBox.GetPandora().Bot_01.gameObject;


        // start the state machine timer
        _launchClockTime = Time.time;

        seeker = this.gameObject.GetComponent <SeekerScript>();
        if (seeker)
        {
            // we have a seeker script attached.
            isSeeker = true;
        }
    }
    void Awake()
    {
        Time.timeScale = 0.0f;

//		if(ActivityManager.Instance == null)
//			opentimer = 1.0f;
//

        //Check if GOT is null then create one.
        if (!GameObjectTracker.instance)
        {
            Instantiate(GOT);
        }

        if (!ToyBox.GetPandora())
        {
//			Debug.LogError("Toybox Instantuate");
            Instantiate(Pandora);
        }
    }
Example #23
0
    // Use this for initialization
    void Start()
    {
        //Start time.
        if (!ToyBox.GetPandora())
        {
            Debug.LogError("NO F TOYBOX!");
            return;
        }

        ToyBox.GetPandora().TimePaused = false;
        started = true;


        currentState = State.Null;

        if (PlayIntro)
        {
            Camera.SetupCurrent(IntroCam);
            GetComponent <Animation>().Play();
            currentState = State.Intro;

            //Disable the hud if there is one
//			if(ActivityManager.Instance)
//				ActivityManager.Instance.ToggleHud();
        }


        //This is tutorial mode.. turn combos off.
        if (GameObjectTracker.instance)
        {
            GameObjectTracker.instance.TrackCombo = false;
        }

        //Store the controls manager
        if (loadedControls == null)
        {
            GrabControls();
        }
    }
Example #24
0
    public override void OnActivate()
    {
        base.OnActivate();

        ActivityManager.Instance.ToggleHud(false);

        ActivityManager.Instance.PullCurtain();
        ToyBox.GetPandora().TimePaused = true;

        StartTween.Reset();

        //AudioPlayer.GetPlayer().pop
        ActivityManager.Instance.PopAudio();

        //Pull curtain on open?
        ActivityManager.Instance.DrawCurtain();

        //Set the bg intro animation
        BGIntro.Reset();
        BGIntro.Play(true);

        //Local hack to disable the intial OnClick call on activate.
        started = false;
    }
 //Make sure to apply any card data to the player prefs if the application quits.
 public void OnApplicationQuit()
 {
     ToyBox.GetPandora().TimePaused = true;
     SaveAllData();
 }
Example #26
0
 void OnClick()
 {
     ToyBox.GetPandora().Bot_01.TriggerOverheat();
 }
    void OnClick()
    {
        //Distance must be bigger than the range to trigger a pause.
        if (!isPaused)
        {
            if (Distance < Range && !hack)
            {
                return;
            }
        }



        isInGame = !isInGame;
        isPaused = !isPaused;



        if (windowTransform != null)
        {
            windowTransform.Play(!isPaused);
        }


        //Set the pause time
        ToyBox.GetPandora().TimePaused = isPaused;

        if (isPaused)
        {
            /*
             * We can enable the activities and prep them for the main menu
             */
            //_invActivity.ActivityOn();


            AssignPausePosition();

            InGameScreen.TogglePanel(false);             //.TogglePanelFade();
            //ActivityManager.Instance.PullCurtain();

            ActivityManager.Instance.PushActivity(ActivityManager.ManagerActivities.Pause, true);

            //Play audio sound
            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Pause);
        }
        else
        {
            /*
             * Make sure all activities are closed
             */
            //_invActivity.ActivityOff();
            InGameScreen.TogglePanel(true);             //.TogglePanelFade();


            //Clear everything when unpause!! //No !
            ActivityManager.Instance.ClearActivities();

            //Open Says Me
            //ActivityManager.Instance.DrawCurtain();
//			ActivityManager.Instance.TriggerTitleAnimation();

            //No! lol
            //ActivityManager.Instance.PopActivity();
        }
    }
 void OnClick()
 {
     ToyBox.GetPandora().ClearFreeCannons();
 }
    bool Init()
    {
        Camera twoDCam = this.GetComponentInChildren <Camera>();

        if (twoDCam == null)
        {
            Debug.LogError("No Camera FUI2dLocManager");
            isFullyInit = false;
            return(isFullyInit);
        }
        _2dCamera = twoDCam;

        ToyBox tb = ToyBox.GetPandora();

        if (tb == null)
        {
//			Debug.LogError("No tb FUI2dLocManager");
            isFullyInit = false;
            return(isFullyInit);
        }

        // now check for a world camera.  all targets are the same layer.
        if (ToyBox.GetPandora())
        {
            if (ToyBox.GetPandora().Camera_01)
            {
                _worldCamera = ToyBox.GetPandora().Camera_01.GetComponent <Camera>();
            }
        }


        if (_worldCamera == null)
        {
            Debug.LogWarning("No World Camera FUI2dLocManager, try again...");
            isFullyInit = false;
            return(isFullyInit);
        }

        // we should have a panel to manage
        _myPanel = this.GetComponentInChildren <UIPanel>();
        if (_myPanel == null)
        {
            Debug.LogWarning("No Panel in FUI2dLocManager, try again...");
            isFullyInit = false;
            return(isFullyInit);
        }

        poolIconLocCannons = new List <IconLocObject>();
        if (poolIconLocCannons == null)
        {
            Debug.LogError("failed to create poolIconLocCannons int FUI2dLocManager");
            isFullyInit = false;
            return(isFullyInit);
        }
        poolIconLocAlerts = new List <IconLocObject>();
        if (poolIconLocAlerts == null)
        {
            Debug.LogError("failed to create poolIconLocAlerts int FUI2dLocManager");
            isFullyInit = false;
            return(isFullyInit);
        }
        poolIconLocPowerUps = new List <IconLocObject>();
        if (poolIconLocPowerUps == null)
        {
            Debug.LogError("failed to create poolIconLocAlerts int FUI2dLocManager");
            isFullyInit = false;
            return(isFullyInit);
        }

        poolIconLocPhaseNotif = new List <IconLocObject>();
        if (poolIconLocPhaseNotif == null)
        {
            Debug.LogError("failed to create poolIconLocPhaseNotif int FUI2dLocManager");
            isFullyInit = false;
            return(isFullyInit);
        }
        poolIconLocCC = new List <IconLocObject>();
        if (poolIconLocCC == null)
        {
            Debug.LogError("failed to create poolIconLocCC int FUI2dLocManager");
            isFullyInit = false;
            return(isFullyInit);
        }

        isFullyInit = true;
        return(isFullyInit);
    }
    public void ActivateBossRoom(bool active)
    {
        //Play the activating animation and objects.
        if (active)
        {
            //Enable the object.

            _bossRoom.SetActive(true);

            //Set the bool variable
            _isBossLevel = true;

            ToyBox.GetPandora().SetSlowMotion(true, RoomChangeSpeed);

            //Set the speed to forward.
            _bossRoom.GetComponent <Animation>()["BossA"].speed = -1.0f;
            _bossRoom.GetComponent <Animation>()["BossA"].time  = _bossRoom.GetComponent <Animation>()["BossA"].length;

            _bossRoom.GetComponent <Animation>().Play("BossA");

            _transitionAnimationName = "Warp";

            //Play out the current room animation.
            _currentRoom.GetComponent <Animation>()[_transitionAnimationName].speed = 1.0f;
            _currentRoom.GetComponent <Animation>()[_transitionAnimationName].time  = 0.0f;
            _currentRoom.GetComponent <Animation>().Play(_transitionAnimationName);


            //Call the notification.
            ActivityManager.Instance.BossNotif.ActivateNotification();
        }
        else
        {
            //Disable the room effects.
            //_bossRoom.SetActive(false);
            _transitionRoom = _currentRoom;
            _currentRoom    = _bossRoom;

            //Set the bool variable
            //_isBossLevel = false;

            if (ToyBox.GetPandora())
            {
                ToyBox.GetPandora().SetSlowMotion(true, BossFinishSpeed);
            }


            _transitionAnimationName     = "Warp";
            _exitTransitionAnimationName = "BossA";

            //Let the transition level begin at the end and play backward.
            //Set the speed to backward and the time to the end of the animation
            //Play the transition animation
            _currentRoom.GetComponent <Animation>()[_exitTransitionAnimationName].speed = 1.0f;
            _currentRoom.GetComponent <Animation>()[_exitTransitionAnimationName].time  = 0.0f;
            _currentRoom.GetComponent <Animation>().Play(_exitTransitionAnimationName);



            //Play out the current room animation.
            _transitionRoom.GetComponent <Animation>()[_transitionAnimationName].speed = -1.0f;
            _transitionRoom.GetComponent <Animation>()[_transitionAnimationName].time  = _transitionRoom.GetComponent <Animation>()[_transitionAnimationName].length;
            _transitionRoom.GetComponent <Animation>().Play(_transitionAnimationName);

            _inTransition = true;

            //Call the notification.
            ActivityManager.Instance.BossNotif.CloseWindow();
        }
    }