Exemplo n.º 1
0
    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);
//
//		}
    }
    public void Overwrite(Statistics stats)
    {
        //Copy the main data.
        TimeAmount = stats.TimeAmount;
        startTime  = stats.startTime;
        endTime    = stats.endTime;


        //Int for holding the score.
        StatsScore = stats.StatsScore;

        //The score modifier.
        StatsValueModifier = stats.StatsValueModifier;

        //Store the cannon we completed with.
        completedCannonType = stats.completedCannonType;


        int index = 0;

        //Copy the data entries.
        foreach (DataEntry de in _statisticsEntries)
        {
            de.SetData(stats._statisticsEntries[index].Data);
            index++;
        }
    }
Exemplo n.º 3
0
    public override bool isCannonItem(EntityFactory.CannonTypes t)
    {
        if (type == t)
        {
            return(true);
        }

        return(false);
    }
    public CannonItemCard FindCardByCannonType(EntityFactory.CannonTypes type)
    {
        //Get the index.
        int cardindex = FindCannonCard(type);

        if (cardindex == -1)
        {
            return(null);
        }

        return(CardDeck[cardindex] as CannonItemCard);
    }
    public void Clear()
    {
        //Set clearing values.
        IsOpen      = false;
        IsAvailable = true;

        Type = EntityFactory.CannonTypes.NULL;

        if (StartActive)
        {
            IsOpen = true;
            Type   = EntityFactory.CannonTypes.Zebra;
        }

        _myItem   = null;
        _iconName = "Thermometer-Units";
    }
Exemplo n.º 6
0
    void Update()
    {
        if (_data == null)
        {
            phaseLabel.text        = "XX:XX";
            phaseSprite.spriteName = "phaseunknown";
            return;
        }

        if (completed)
        {
            return;
        }

        if (_data.PhaseCompletionPunch != -1.0f)
        {
            //Debug.Log("Phase Completion Punch Pass at " + FormatSeconds(_data.PhaseCompletionPunch));

            //set the phase data
            phaseLabel.text                = FormatSeconds(_data.PhaseCompletionPunch);
            phaseSprite.spriteName         = _data.IconTextureName;
            phaseBestTimeBadgeSprite.alpha = 0.0f;
            CannonBadge.alpha              = 1.0f;


            //Grab player data.
            EntityFactory.CannonTypes cType = _data.PhaseStatistics.CompletionCannon;
            BaseItemCard card = GameObjectTracker.instance._PlayerData.FindCardByCannonType(cType);

            //Check if its a valid card theng grab the icon name.
            if (card == null || cType == EntityFactory.CannonTypes.NULL ||
                cType == EntityFactory.CannonTypes.Empty)
            {
                CannonBadge.spriteName = "phaseunknown";
                completed = true;
                return;
            }

            CannonBadge.spriteName = card.DisplayInfo.IconName;

            //Maybe check for objective completion here.

            //Set completed.
            completed = true;
        }
    }
    int FindCannonCard(EntityFactory.CannonTypes type)
    {
        int index = 0;

        foreach (BaseItemCard card in CardDeck)
        {
            //If we match return the index we are at.
            if (card.isCannonItem(type))
            {
                return(index);
            }

            //Increment the counter
            index++;
        }

        return(-1);
    }
    public bool SetCannonSlot(EntityFactory.CannonTypes type, int index)
    {
        //If we are trying to apply the same cannon just return false;
        if (CannonSlots[index].type == type)
        {
            return(false);
        }


        //Assign the type.
        CannonSlots[index].type = type;

        //Clear out the slot
        ClearCannonSlot(index);

        //Slot is set so return true.
        return(true);
    }
    public void AssignSlot(EntityFactory.CannonTypes type, int index)
    {
        //Set the slot type.
        _itemSlots[index].Type     = type;
        _itemSlots[index].IconName = "Thermometer-Units";

        //Assign the icon name
        if (type != EntityFactory.CannonTypes.NULL)
        {
            _itemSlots[index].IconName = EntityFactory.GetEF().GetCannonIconName(type);
        }


        //Mark Dirty or apply to save here.

        //Grab the name
        //string slotname = "Cannon_Slot_" + index.ToString();

        //Set the int.
        //FileFetch.SetInt(slotname,(int)type);
    }
    public void PunchPhaseTime(float t, EntityFactory.CannonTypes cannonCompletion)
    {
        int index     = 0;
        int cardIndex = -1;

        //if we have somthign in the list we set the timer to the last phase in the list.
        if (_infinteModeData.PhaseList.Count > 0)
        {
            //Grabbing index for the current phase, which is the one that should be getting punched.
            index = _infinteModeData.PhaseList.Count - 1;

            //Setting time for the completion punch.
            _infinteModeData.PhaseList[index].PhaseCompletionPunch = t;

            //Set the cannon type in the statistics.
            _infinteModeData.PhaseList[index].PhaseStatistics.CompletionCannon = cannonCompletion;

            //We should stop the time for the stats here too.
            _infinteModeData.PhaseList[index].PhaseStatistics.StopTimer();

            //Lets add the phases stats to the main game stats.
            //GameObjectTracker.GetGOT().gameRunStatistics.AddStatistics(_infinteModeData.PhaseList[index].PhaseStatistics);

            //Perform a test on the completion cannon if there is a matching item card.
            cardIndex = FindCannonCard(cannonCompletion);

            //If we didnt return a proper value just leave as there is nothing.
            if (cardIndex == -1)
            {
                return;
            }


            //We have found a match if we made it here. Lets set the card dirty to be updated.
            CardDeck[cardIndex].IsDirty = true;

            //Since the phase data is for the given item card. lets add the statistics.
            CardDeck[cardIndex].ItemStats.AddStatistics(_infinteModeData.PhaseList[index].PhaseStatistics);

            //Grab the mission
            BaseMission m = CardDeck[cardIndex].BreathlessMission;

            //here we check if we have a breathless mission, or we return.
            if (!m)
            {
                return;
            }


            //Lets check if our mission objectives are out of the range we willt ry to access it at.
            if (m.MissionObjectives[index] == null)
            {
                print("Trying to assign a phase stat for a mission that is not there!");
                return;
            }

            //Set the objective at the same index as phase statistics.
            m.MissionObjectives[index].ObjectiveStatistics = _infinteModeData.PhaseList[index].PhaseStatistics;

            //SaveItemCardData();
        }
    }
Exemplo n.º 11
0
 public void SubmitTurnData(float PPS, EntityFactory.CannonTypes SlotA, EntityFactory.CannonTypes SlotB)
 {
 }
Exemplo n.º 12
0
 public virtual bool isCannonItem(EntityFactory.CannonTypes t)
 {
     return(false);
 }
Exemplo n.º 13
0
    void UpdateState()
    {
        switch (currentState)
        {
        case LevelStates.Introduction:
        {
            break;
        }

        case LevelStates.TestSpawn:
        {
            break;
        }

        case LevelStates.Phasing:
        {
            //If we dont have a current phase, then we will assign it one from the list!
            if (!currentPhase)
            {
                currentPhase = Instantiate(PhaseTypes[currentPhaseIndex]) as BasePhase;

                //Check which phase we are on.
//				if(currentPhaseIndex == 5)
                if (currentPhase.TransitionLevel)
                {
                    //GameObjectTracker.instance.vWorld.GotoHeavyRoom();
                    GameObjectTracker.instance.vWorld.GotoNextRoom();
                    return;
                }
            }

            //If we have finished the phase
            if (currentPhase.IsComplted())
            {
                EntityFactory.CannonTypes completedCannon = EntityFactory.CannonTypes.Empty;

                //Find out what cannon we are using and set the phase.
                if (PandoraBox.Bot_01.IsCannonAttached())
                {
                    completedCannon = PandoraBox.Bot_01.GetCannon().CannonTypeInfo;
                }

                //Handle timing and rewards
                //gameRewards.DisplayFruit(currentPhaseIndex,currentPhase.GetPhaseTime());
                GameObjectTracker.GetGOT()._PlayerData.PunchPhaseTime(currentPhase.GetPhaseTime(), completedCannon);
                BreathlessStats.AddStatistics(currentPhase.Data.PhaseStatistics);


                //Stop the music fo the current phase.
                //currentPhase.StopMusic();

                //Increment the phase index.
                currentPhaseIndex++;

                //Delete the current phase.
                Destroy(currentPhase.gameObject);
            }

            break;
        }



        case LevelStates.Dead:
        {
            //Update the timer.
            localTimer += Time.deltaTime;

            if (localTimer > 0.5f)
            {
                //Go to game over state.
                currentState = LevelStates.GameOver;

                //Go back to regular motion.
                //PandoraBox.SetSlowMotion(false);

                //Reset the local timer.
                localTimer = 0.0f;

                //Set to the game over timer;
                PandoraBox.Camera_01.SetGameOver(true);

                //Tell the HUD to activate Game Over
                //PandoraBox.OnScreenControls.ActivateGameOver();
                ActivityManager.Instance.PushActivity(ActivityManager.ManagerActivities.GameOver);

                //Play the game over music.
                //AudioPlayer.GetPlayer().PlayAudioClip(GameOverMusic);
                AudioPlayer.GetPlayer().PlaySound(GameOverIntro);

                //Set the timer for gameover music
                //musictimer = Time.time;

                //Lets apply the earnings of the phases here.
                GameObjectTracker.GetGOT()._PlayerData.SaveAllData();
            }



            break;
        }

        case LevelStates.GameOver:
        {
            //Update the timer to go into review mode.
            localTimer += Time.deltaTime;

            if (localTimer > 0.3f)
            {
                PandoraBox.SetSlowMotion(false);
                currentState = LevelStates.Review;
            }


            break;
        }

        case LevelStates.Review:
        {
            //W do nothing here yet.
//			if(!audio.isPlaying)
//			{
//				audio.clip = GameReviewMusic;
//				audio.loop = true;
//				audio.Play();
//
//				//GameReviewMusic.
//			}
            //If enough time has passed since the time stamp.
            if ((Time.time - musictimer) > GameOverMusic.length)
            {
                AudioPlayer.GetPlayer().PlayAudioClip(GameReviewMusic);
            }

            break;
        }

        default:
        {
            print("There is no Game State");
            return;
        }
        }
    }