public void TestObjectTrackerPlayerCount()
        {
            GameObject temp = new GameObject();

            temp.AddComponent <GameObjectTracker>();

            GameObjectTracker got = temp.GetComponent <GameObjectTracker>();

            for (int i = 0; i < 5; i++)
            {
                GameObject obj1 = new GameObject();
                obj1.tag = "Player";
                got.AddObject(obj1);
            }
            for (int i = 0; i < 3; i++)
            {
                GameObject obj1 = new GameObject();
                obj1.tag = "Enemy";
                got.AddObject(obj1);
            }

            int actual = got.GetPlayerGameObjects().Count;

            Assert.AreEqual(5, actual);
        }
        public void TestObjectTrackerRemovePlayerObject()
        {
            GameObject temp = new GameObject();

            temp.AddComponent <GameObjectTracker>();

            GameObjectTracker got         = temp.GetComponent <GameObjectTracker>();
            List <GameObject> tempPlayers = new List <GameObject>();

            for (int i = 0; i < 5; i++)
            {
                GameObject obj1 = new GameObject();
                obj1.tag = "Player";
                got.AddObject(obj1);
                tempPlayers.Add(obj1);
            }
            for (int i = 0; i < 3; i++)
            {
                GameObject obj1 = new GameObject();
                obj1.tag = "Enemy";
                got.AddObject(obj1);
            }
            got.RemoveObject(tempPlayers[1]);
            int actual = got.GetPlayerGameObjects().Count;

            Assert.AreEqual(4, actual);
        }
Esempio n. 3
0
    public void Damage(float deg)
    {
        if (DefenseUnitSlot == null)
        {
            Debug.LogWarning("No DefensiveSlot in BOT Damage");
            return;
        }
        if (!DefenseUnitSlot.IsActivated())
        {
            AddHeat(deg);

            if (HurtSound)
            {
                AudioPlayer.GetPlayer().PlaySound(HurtSound);
            }

            if (DamageEffect)
            {
                DamageEffect.Play();
            }
        }

        //Register with GOT.
        GameObjectTracker.GetGOT().PlayerHit(deg);
    }
    void OnDestroy()
    {
        //Do a check for GOT incase its not there.
        if (!GameObjectTracker.GetGOT())
        {
            return;
        }

        if (currentWave)
        {
            //If we are destroyed at a boss level that means we have updated to a new phase while boss still exists
            //or updated via boss battle itself.

            if (Boss)
            {
                //Send the message for boss being completed
                GameObjectTracker.GetGOT().BossWaveCompleted();

                //Pop the music.
                AudioPlayer.GetPlayer().PopTrack();
            }


            //Clean up our waves upon our destruction
            Destroy(currentWave.gameObject);
        }
    }
    // Update is called once per frame
    void Update()
    {
        gems = GameObjectTracker.GetGOT().GetGemsCollected();

        myLabelText  = "" + gems + "";
        myLabel.text = myLabelText;
    }
Esempio n. 6
0
    public void PopulateCannonsList()
    {
        // We have the activity.  Populate the grid with Cannons!!
        EntityFactory ef = EntityFactory.GetEF();

        if (ef == null)
        {
            return;
        }

        // Getting ItemCards from Playerdata to populate list based on item cards not the entity factory calalog
        GameObjectTracker go = GameObjectTracker.GetGOT();

        if (go == null)
        {
            return;
        }

        if (_CardSelectors == null)
        {
            return;
        }

        // keeping track of the list of cannon selection objects locally

        // the next object to temp strore data for the list
        CannonSelectionObject newCannon = null;


        // Grab the deck of cards from the player data
        allItemCards = go._PlayerData.CardDeck;

        int cannonItemCardIndex = 0;

        foreach (CannonItemCard canItem in allItemCards)
        {
            //Create cannon and assign the reference.
            newCannon = NGUITools.AddChild(_gridOfCannons.gameObject, _refPrefab.gameObject).GetComponent <CannonSelectionObject>();
            newCannon.MyCannonCard = canItem;

            //Set the checkbox root.
            UICheckbox cbox = newCannon.GetComponent <UICheckbox>();
            if (cbox)
            {
                cbox.radioButtonRoot = this.transform;
            }

            _gridOfCannons.Reposition();

            _CardSelectors.Add(newCannon);

            cannonItemCardIndex++;
        }

        //Is populated is true,
        isPopulated = true;

        //And list give the list to the activity manager so they can grab it.
        ActivityManager.Instance.CardSelectors = _CardSelectors;
    }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
    void Init()
    {
        if (GameObjectTracker.GetGOT())
        {
            //Set default data.
            if (pdata == null)
            {
                pdata = GameObjectTracker.GetGOT().FullStatistics;
            }


            int index = 0;
            foreach (Statistics.DataEntry data in pdata.AllDataEntries)
            {
                FUIStatObject newStat = null;

                // add the new stat as a child to the table
                newStat = NGUITools.AddChild(myTable.gameObject, refStatObject.gameObject).GetComponent <FUIStatObject>();

                //Set the data first so we can assign the value upon assigning the statistic reference.
                newStat.StatType = data.EntryType;
                newStat.myStat   = pdata;

                statObjects.Add(newStat);

                myTable.Reposition();
                index++;
            }

            isFullyInit = true;
        }
    }
    public void AssignSlot(EntityFactory.CannonTypes type, int index)
    {
        //Assign the player data type.
        GameObjectTracker.GetGOT()._PlayerData.AssignSlot(type, index);

        //Set the command center.
        //CommandCenter_01.SetCannonSlot(GameObjectTracker.GetGOT()._PlayerData.CannonSlots[index],index);

        //New code for slots.
        //CommandCenter_01.SetItemSlot(GameObjectTracker.GetGOT()._PlayerData.ItemSlots[index],index);

//		//Write to the player data.
//		if(index == 0)
//		{
//			//Temp
//			GameObjectTracker.GetGOT()._PlayerData.CannonSlotA = type;
//			GameObjectTracker.GetGOT()._PlayerData.CannonSlots[index] = type;
//
//			//Set the command center.
//			CommandCenter_01.SetCannonSlot(GameObjectTracker.GetGOT()._PlayerData.CannonSlotA,index);
//
//		}
//
//		//Write to the player data.
//		if(index == 1)
//		{
//			GameObjectTracker.GetGOT()._PlayerData.CannonSlotB = type;
//
//			//Set the command center.
//			CommandCenter_01.SetCannonSlot(GameObjectTracker.GetGOT()._PlayerData.CannonSlotB,index);
//
//		}
    }
    // Use this for initialization
    protected virtual void Start()
    {
        //Add a phase to the statistics every time we create a new phase.
        GameObjectTracker.GetGOT()._PlayerData.AddPhase(CopyPhaseData());

        //Play the audio track.
        AudioPlayer.GetPlayer().PlayAudioClip(PhaseSoundtrack);
    }
    // Update is called once per frame
    void Update()
    {
        float localTimer = GameObjectTracker.GetGOT().localTargetTimer;
        int   points     = GameObjectTracker.GetGOT().GetCurrentPoints();
        float pps        = points / localTimer;

        myLabel.text = "" + pps;
    }
    protected void HandleWaveCreation()
    {
        if (!currentWave)
        {
            //If boss flag is true spawn a boss wave!
            if (Boss)
            {
                //Create a boss wave.
                currentWave = CreateBossWave();

                //Send the message for boss started
                GameObjectTracker.GetGOT().BossWaveStart();

                //Store the time off the current music so we can resume.
                //currentaudiotime = AudioPlayer.GetPlayer().audio.time;

                //Set and play the boss music.
                //AudioPlayer.GetPlayer().PlayAudioClip(BossSoundtrack);

                //Push the boss sound track.
                AudioPlayer.GetPlayer().PushTrack(BossSoundtrack);

                return;
            }

            currentWave = CreateWave();
        }

        if (currentWave.IsCompleted())
        {
            //If it was a boss wave do boss clean up stuff here.
            if (Boss)
            {
                //turn boss off.
                Boss = false;

                //Incriment the count of bosses destroyed.
                bossWaveCount++;

                //Send the message for boss being completed
                GameObjectTracker.GetGOT().BossWaveCompleted();

                //Return to our regular music programming.
                //AudioPlayer.GetPlayer().PlayAudioClip(PhaseSoundtrack,currentaudiotime);

                //Pop from the boss track.
                AudioPlayer.GetPlayer().PopTrack();
            }

            //print("Wave Completed!");
            Destroy(currentWave.gameObject);
            wavesDestroyedCount++;
            totalWavesDestroyed++;

            //Send the message for wave being completed
            GameObjectTracker.GetGOT().WaveCompleted();
        }
    }
Esempio n. 13
0
    // Update is called once per frame
    void Update()
    {
        phaseDataList = GameObjectTracker.GetGOT()._PlayerData.Breathless.PhaseList;


        if (phaseDataList != null && phaseCount < phaseDataList.Count)
        {
            // if we have a data list, and the data list is greater than the number
            // of phases we have created, the last phasecount "Should" be the last
            // punched phase, grab that and create the result object and add it to the grid.

            BasePhase.PhaseData lastPhaseData = phaseDataList[phaseCount];

            // after all is done, increment our phase count
            phaseCount++;

            FUIPhaseResultObject newPhaseResult = null;
            newPhaseResult = NGUITools.AddChild(myGrid.gameObject, refPhaseResultObject.gameObject).GetComponent <FUIPhaseResultObject>();
            if (lastPhaseData.PhaseCompletionPunch < 0)
            {
                newPhaseResult.phaseSprite.spriteName = "phaseunknown";
                newPhaseResult.phaseLabel.text        = "Failed";
            }
            else
            {
                newPhaseResult.phaseSprite.spriteName = lastPhaseData.IconTextureName;
                newPhaseResult.phaseLabel.text        = FormatSeconds(lastPhaseData.PhaseCompletionPunch);
                //newPhaseResult.PhaseData = lastPhaseData;
            }
            // regardless if the phases is punched or not, store the given phase name
            // this way when it gets punched, we can update the data
            newPhaseResult.givenSpriteName = lastPhaseData.IconTextureName;

            phaseResults.Add(newPhaseResult);

            // now we've added any new phases that we need.
            // real quick iterate through the lists, and update any new phases that
            // have now been punched
            for (int i = 0; i < phaseCount; i++)
            {
                if (phaseDataList[i].PhaseCompletionPunch > 0)
                {
                    phaseResults[i].phaseSprite.spriteName = phaseResults[i].givenSpriteName;
                    phaseResults[i].phaseLabel.text        = FormatSeconds(phaseDataList[i].PhaseCompletionPunch);
                    phaseResults[i].PhaseData = phaseDataList[i];
                }
            }

            myGrid.Reposition();

            // update the phase title
            if (labelPhaseResultsTitle)
            {
                labelPhaseResultsTitle.text = phaseResultsTitles[phaseCount];
            }
        }
    }
 //Checks the combo required to mark the phase as complete.
 protected void CheckComboCompletion()
 {
     //Get the GOT's multiplier count and check if we reached the combo required.
     if (GameObjectTracker.GetGOT().GetMultiplier() >= ComboCompletionRequirement ||
         bossWaveCount >= BossCompletionRequirement)
     {
         Completed = true;
     }
 }
    }    //All Collisions ON Stay Check

    protected void ProcessBotandCCTouchDamage(Collision col)
    {
        //We must make sure we have a self... if not.. well... return!
        if (self == null)
        {
            return;
        }

        // when was the last time we did damage?  able to do damage every two seconds

        if (!canTouchDamage)
        {
            return;
        }

        //Check if we collide with a CommandCenter.
        if (col.gameObject.CompareTag("CommandCenter") && (!self.IsDestroyed()))         //&& selfAsEnemy.AttackCommandCenters))
        {
            CommandCenter c = col.gameObject.GetComponent <CommandCenter>();

            c.Damage(TouchDamageToCC);
            self.Damage(touchDamageToSelf);                      // this may not kill me
            // we do our damage, set can do damage off and hit the clock
            canTouchDamage   = false;
            touchDamageClock = Time.time;

            //Send the detonation message to the GOT
            GameObjectTracker.GetGOT().TargetDetonated();
        }
        //Check if we collide with a Player Bot
        //TODO:CRashing here.
        if (col.gameObject.CompareTag("Bot") && (!self.IsDestroyed()))         //&& selfAsEnemy.AttackBots))
        {
            Bot b = col.gameObject.GetComponent <Bot>();

            //Dont blow up if shield is active.
            if (b.IsShieldActive())
            {
                return;
            }

            b.Damage(TouchDamageToBot);
            self.Damage(touchDamageToSelf);              // this may not kill me

            //Send the detonation message to the GOT
            GameObjectTracker.GetGOT().TargetDetonated();
            // we do our damage, set can do damage off and hit the clock
            canTouchDamage   = false;
            touchDamageClock = Time.time;
        }



        // end processing bot and cc
    }
    public override void BossCompleted()
    {
        //If we complete a boss on game over we stick to the boss level.
        if (gameover)
        {
            return;
        }

        //Just play the animation for now.
        GameObjectTracker.GetGOT().vWorld.ActivateBossRoom(false);
    }
Esempio n. 17
0
    public void SetDataEntry(Statistics stats)
    {
        GameStatistics = stats;

        //Calculate pps.
//		int score =  GameStatistics.Score;
//		float pps = (float)score/GameStatistics.TimeAmount;


        //Set the score text to PPS.
        //ScoreText.text = GameObjectTracker.GetGOT().GamePPS.ToString();
        ScoreText.text = GameObjectTracker.GetGOT().RunStatistics.PPS.ToString();
    }
Esempio n. 18
0
    void Start()
    {
        gameObjectTracker = new GameObjectTracker();
        lastGuestInput    = new GuestInput();
        miceTracker       = new MiceTracker();

        Cursor.visible = false;

        stateFluxClient = GameObject.Find("StateFlux").GetComponent <StateFluxClient>();
        if (stateFluxClient == null)
        {
            DebugLog("Failed to connect with StateFluxClient");
            return;
        }
        stateFluxClient.AddListener(this);

        // lobby makes sure we are logged in before starting a game
        playerId = stateFluxClient.clientId;

        // when the game instance starts, LobbyManager receives a game instance start notification and saves these
        // we copy them here for convenience
        hostPlayer = LobbyManager.Instance.hostPlayer;
        players    = LobbyManager.Instance.players;
        thisPlayer = players[playerId];
        thatPlayer = players.Values.Where(p => p.Id != playerId).FirstOrDefault();

        CreateMousePointerGameObjects();

        if (stateFluxClient.isHosting)
        {
            var g = GameObject.Find("State_IsGuest");
            g.SetActive(false);
            var textMesh = g.GetComponentInChildren <TextMesh>();
            if (textMesh != null)
            {
                textMesh.color = StateFluxTypeConvert.Convert(thisPlayer.Color);
            }
            StartCoroutine(gameObjectTracker.SendStateAsHost());
        }
        else
        {
            var g = GameObject.Find("State_IsHost");
            g.SetActive(false);
            var textMesh = g.GetComponentInChildren <TextMesh>();
            if (textMesh != null)
            {
                textMesh.color = StateFluxTypeConvert.Convert(thisPlayer.Color);
            }
            StartCoroutine(nameof(SendInputAsGuest));
        }
    }
        //Returns true if successful and there has been stats assigned to the mission.
        public bool SetObjectiveNameObject(string missionName, int index = 0)
        {
            string objstatname = missionName + "_ObjStats" + index + "_" + ObjectiveLabel;

            //Check if there are no stats yet assigned to the objective then we return
            if (_objectiveStats == null)
            {
                //Here is where we can check for the already existing objective stat.
                //Lets look for the objects already in the scene to assign upon reload.
                foreach (Object o in FindSceneObjectsOfType(typeof(Statistics)))
                {
                    if (o.name == objstatname)
                    {
                        _objectiveStats = (Statistics)o;

                        //remake parent.

                        DontDestroyOnLoad(_objectiveStats.gameObject);

                        //Return false that object did not exist.
                        return(false);
                    }
                }

                //This is where the creation takes place
                _objectiveStats = Instantiate(GameObjectTracker.GetGOT()._PlayerData.BlankStatistics) as Statistics;

                //Apply the mission name to the objective label
                _objectiveStats.name = objstatname;


                //Lets load since we are created.
                _objectiveStats.LoadFromPlayerPrefs();

                //Keep this lil guy around.
                DontDestroyOnLoad(_objectiveStats.gameObject);

                //Return false that object did not exist.
                return(false);
                //print("Stat Created!!!!!!!!!!!!!!!!!!:" + objstatname);
            }

            //Apply the mission name to the objective label
            _objectiveStats.name = objstatname;


            //Print the name
//			print("ObjStats Name Set: " + _objectiveStats.name);
            return(true);
        }
    public override void CannonPickedUp()
    {
//		//If we are at the intro stage, move on to the start of the game upon picking up the cannon.
        if (currentState == LevelStates.Introduction)
        {
            //Begin the phasing level.
            currentState = LevelStates.Phasing;

            //Stop our audio.
            //audio.Stop();

            //Start teh game statistics counter.
            GameObjectTracker.GetGOT().StartGame();
        }
    }
Esempio n. 21
0
 public Tracker()
 {
     flushListener             = new FlushListener(this);
     startListener             = new StartListener(this);
     startLocalStorageListener = new StartLocalStorageListener(this);
     completable = new CompletableTracker();
     completable.setTracker(this);
     alternative = new AlternativeTracker();
     alternative.setTracker(this);
     accessible = new AccessibleTracker();
     accessible.setTracker(this);
     trackedGameObject = new GameObjectTracker();
     trackedGameObject.setTracker(this);
     tracker = this;
 }
Esempio n. 22
0
    public void AssignCannonSlotTypes()
    {
        PlayerData _pd = GameObjectTracker.GetGOT()._PlayerData;

        //Set the cannon types.
        for (int i = 0; i < _pd.ItemSlots.Length; i++)
        {
            CommandCenter_01.SetItemSlot(_pd.ItemSlots[i], i);
        }

        CommandCenter_01.TriggerSlotSpawns();

        //Copy slots to active slot array
        _pd.ClearGameSlots();

        //Clear the slots after assigning
    }
Esempio n. 23
0
    //Information linking the actual item.
    protected virtual void Start()
    {
        if (_itemStatistics == null)
        {
            //Create the stat object if there is none. and set its name and parent.
            _itemStatistics                  = Instantiate(GameObjectTracker.GetGOT()._PlayerData.BlankStatistics) as Statistics;
            _itemStatistics.name             = "IC_" + this.Label + "_ItemStats";
            _itemStatistics.transform.parent = this.transform;

            //And load if we are awake and there is no item.
            _itemStatistics.LoadFromPlayerPrefs();
        }


        Init();

        //	print("Base Item Card Start : End");
    }
    void SetupOptions()
    {
        GameObjectTracker go = GameObjectTracker.instance;

        if (go == null)
        {
            return;
        }

        //Grab the slider values from player data and set it.
        MusicSlider.sliderValue = (go._PlayerData.Options.Music);
        SFXSlider.sliderValue   = (go._PlayerData.Options.SoundFX);

        MusicSlider.ForceUpdate();
        SFXSlider.ForceUpdate();

        setup = true;
    }
    PhaseData CopyPhaseData()
    {
        //Copy over the phase data to the struct for player data.
        data = new PhaseData();

        data.ComboToComplete  = ComboCompletionRequirement;
        data.BossesToComplete = BossCompletionRequirement;
        data.WavesToBoss      = WaveCountForBoss;
        data.ScoreMultiplier  = ScoreMultiplier;
        data.Description      = Description;
        data.IconTextureName  = IconTextureName;

        data.Label = "Phase Name: " + this.name;

        data.PhaseStatistics = GameObjectTracker.GetGOT().PushStatistics("PhaseStat_" + this.name, ScoreMultiplier);

        //Set the name of the phase so we can find in the scene view easily.
        name = "GamePhase_" + name;

        return(data);
    }
Esempio n. 26
0
    /// <summary>
    /// Over heat function that is called when the current temperature exceeeds the maximum temperature capability.
    /// This function will handle all the code for when a bot over heats.
    /// </summary>
    void OverHeat()
    {
        //Set the timestamp for overheating
//		pickuptimestamp = Time.time;
//
//		//Play the over heated effect.
//		if(OverheatEffect)
//		{
//			OverheatEffect.Play();
//		}
//
//
//		//First things first is we detach teh cannon now dont we?
//		connectorcontroller.DetachCannon();

        //Send the message
        GameObjectTracker.GetGOT().PlayerOverHeated();

        //Hide the temp guage.
        isTempVisible = false;
    }
Esempio n. 27
0
    public override void ReceiveCollisionInfo(Collision col)
    {
        //Check if we collide with a CommandCenter.
        if (col.gameObject.CompareTag("Target"))
        {
            Target t = col.gameObject.GetComponent <Target>();
            // if we touch the command Center add health,
            // but only certain amount per second
            if (isAffective && !t.IsDestroyed() && (Time.time - timeStartedDoingDamage) > damageDoingFreq)
            {
                // TODO: for now, we are going to add negative damage, should work
                t.Damage(damageToDeal);
                // print("Doing +" + damageToDeal + " Damage to Target!");

                //Call the message
                GameObjectTracker.GetGOT().DeathBeamAttack();

                timeStartedDoingDamage = Time.time;
            }
        }
    }
Esempio n. 28
0
    public void HitTarget()
    {
        //Grab the GOT
        GameObjectTracker go = GameObjectTracker.instance;

        switch (ID)
        {
        case BallSourceID.Bot:
        {
            go.TargetHit();
            break;
        }

        case BallSourceID.Capture:
        {
            go.CaptureHits();
            break;
        }

        case BallSourceID.Deflect:
        {
            go.DeflectHit();
            break;
        }

        case BallSourceID.Enemy:
        {
            break;
        }

        case BallSourceID.Hot:
        {
            break;
        }

        default:
            break;
        }
    }
Esempio n. 29
0
    public void Shoot()
    {
        //Have to make sure we have a cannon
        if (!connectorcontroller.GetCannon())
        {
            return;
        }

        if (IsShieldActive())
        {
            return;
        }

        //Add a pushback force.
        float f = connectorcontroller.GetCannon().GetPushBackFactor() * PushBackForceFactor;

        Rdbdy.AddForce(myTransform.forward * -f);

        //And we call the cannon's shoot inside the add heat function.
        AddHeat(connectorcontroller.GetCannon().Shoot());

        //Send the message
        GameObjectTracker.GetGOT().PlayerShoot();
    }
Esempio n. 30
0
    /// <summary>
    /// This funtion does the core checks for objects that all base bots shoudl check against.
    /// Things like always searching for cannons and picking them up if there is a free attachment slot and etc.
    /// </summary>
    void OnCollisionEnter(Collision col)
    {
        //Dont pull targets
        if (col.gameObject.CompareTag("CommandCenter"))
        {
            //This is test against shield.
            //Dont process this if shield isnt on.
            //Only melee CC with shield.
            if (!IsShieldActive())
            {
                return;
            }
            //Grab the target.
            Target t = col.gameObject.GetComponent <Target>();

            OnMelee(t, 18.0f, t.CanShatter);
        }



        if (col.gameObject.CompareTag("Target"))
        {
            //This is test against shield.
            //Dont process this if shield isnt on.
            //Only melee CC with shield.
            if (!IsShieldActive())
            {
                return;
            }

            Target t = col.gameObject.GetComponent <Target>();

            if (!t.IsDestroyed())
            {
                OnMelee(t, 50.0f, t.CanShatter);
            }
        }



        //Check if we collide with a cannon.
        if (col.gameObject.CompareTag("Cannon"))
        {
            Cannon c = col.gameObject.GetComponent <Cannon>();

            //check if we are holding shield.
            bool blocking = IsShieldActive();


            if (!IsOverHeated)
            {
                //Call attach for the cannon that we collide with.
                //Check first if we arent blocking then process the picking up of cannon code.
                if (!blocking)
                {
                    if (connectorcontroller.AttachCannon(c))
                    {
                        AudioPlayer.GetPlayer().PlaySound(PickUpCannonSound);

                        //Send to the object tracking system.
                        GameObjectTracker.GetGOT().CannonPickedUp();

                        GetComponent <Animation>().Play(PickupCannonAnimation, PlayMode.StopAll);


                        // when we attach we set the temperature, not just on collide
                        SetTemperature(MinTemperature);

                        //Set the temp guage to view.
                        isTempVisible = true;
                    }
                }
            }

            //Check for melee.
            if (blocking && DefenseUnitSlot.CanDeflect)
            {
                OnMeleeCannon(c, 45.0f);
            }
        }

        //Check if we collide with balls.
        if (col.gameObject.CompareTag("Ball"))
        {
            Ball b = col.gameObject.GetComponent <Ball>();


            if (IsShieldActive())
            {
                if (b.ID != Ball.BallSourceID.Netural && b.ID != Ball.BallSourceID.Hot && b.IsActive())
                {
                    OnBlockBall(b);
                    return;
                }

//				if(!b.IsActive())
//				{
//					PushBall(b);
//					return;
//
//				}
            }

            //We have to make sure we have a cannon attached to pick up a ball and we make sure sheild is not on.
            if (connectorcontroller.GetCannon())
            {
                if (b.GetBallSourceID() == Ball.BallSourceID.Enemy && !DefenseUnitSlot.IsActivated())
                {
//					AddHeat(b.DamageAmount);
////					print("Bot HIT!");
//

                    Damage(b.DamageAmount);
                }

                //Call attach for the cannon that we collide with.
                if (!IsShieldActive())
                {
                    if (connectorcontroller.GetCannon().PickupBall(b))
                    {
                        //Play the audio file.
                        AudioPlayer.GetPlayer().PlaySound(PickUpAmmo);

                        //Set teh ball source.
                        b.SetBallSourceID(Ball.BallSourceID.Bot);

                        //Play ball pick up effect.
                        if (BallCollection)
                        {
                            BallCollection.transform.position = b.transform.position;
                            BallCollection.Play();
                        }

                        if (!isAnimatingCannonPickup)
                        {
                            GetComponent <Animation>().Play(PickupBallAnimation);
                        }
                    }
                }

                if (connectorcontroller.IsCannonFull())
                {
                    AudioPlayer.GetPlayer().PlaySound(CannonFilled);
                }
            }
        }

        if (col.gameObject.CompareTag("Money"))
        {
            Money m = col.gameObject.GetComponent <Money>();

            //We pick up money.
            //Play the effect for picking up a ball.
            if (Collection && GameObjectTracker.instance.multiplierCount > 0)
            {
                //Play the collection animation.
                Collection.Play();
                AudioPlayer.GetPlayer().PlaySound(CollectSound);
            }


            //Do money adding logic here.
            GameObjectTracker.GetGOT().AddMoney(m);
        }

        if (col.gameObject.CompareTag("Wall"))
        {
            //WallCollideParticleEffect.gameObject.SetActive(true);
            WallCollideParticleEffect.Play();
            foreach (ContactPoint point in col.contacts)
            {
                WallCollideParticleEffect.transform.position = point.point;
                WallCollideParticleEffect.transform.forward  = point.normal;
                //Debug.DrawRay(point.point, point.normal);
            }
            //			WallCollideParticleEffect.transform.forward = col.transform.forward;
            //			WallCollideParticleEffect.transform.position = col.transform.position;
        }
    }
Esempio n. 31
0
 public Tracker()
 {
     flushListener = new FlushListener (this);
     startListener = new StartListener (this);
     startLocalStorageListener = new StartLocalStorageListener(this);
     completable = new CompletableTracker();
     completable.setTracker(this);
     alternative = new AlternativeTracker();
     alternative.setTracker(this);
     accessible = new AccessibleTracker();
     accessible.setTracker(this);
     trackedGameObject = new GameObjectTracker();
     trackedGameObject.setTracker(this);
     tracker = this;
 }