Beispiel #1
0
    //use the method when a trigger has been destroyed by user
    public void ClearDegradationTrigger(DegradTrigger trigger)
    {
        // DegradData degradData = DataManager.Instance.GameData.Degradation.DegradationTriggers.Find(x => x.ID == trigger.ID);
        DegradData degradData = degradationTriggers.Find(x => x.TriggerID == trigger.ID);

        // instantiate a stats item from the trigger, but only if it's not the tutorial
        bool bTut = TutorialManager.Instance && TutorialManager.Instance.IsTutorialActive();

        if (bTut == false)
        {
            int nXP = DataLoaderXpRewards.GetXP("CleanTrigger", new Hashtable());
            StatsManager.Instance.ChangeStats(xpDelta: nXP, xpPos: trigger.transform.position, is3DObject: true);
        }

        // DataManager.Instance.GameData.Degradation.DegradationTriggers.Remove(degradData);
        degradationTriggers.Remove(degradData);

        // subtract one from the triggers left to clean
        DataManager.Instance.GameData.Degradation.UncleanedTriggers -= 1;

        // if there are no degradation triggers left, send out a task completion message
        // note -- this will all probably have to change a bit as we get more complex (triggers in the yard, or other locations)
        if (degradationTriggers.Count == 0)
        {
            WellapadMissionController.Instance.TaskCompleted("CleanRoom");
            AudioManager.Instance.LowerBackgroundVolume(0.1f);
            AudioManager.Instance.PlayClip("inhalerCapstone");
            StartCoroutine(ResumeBackgroundMusic());
        }
    }
Beispiel #2
0
    // Note that this function assumes it is okay to be spawning triggers.
    private DegradTrigger PlaceTrigger(DegradData degradData)
    {
        string  triggerID = degradData.TriggerID;
        int     partition = degradData.Partition;
        Vector3 position  = degradData.Position;

        ImmutableDataTrigger triggerData = DataLoaderTriggers.GetTriggerData(triggerID);

        //instantiate all the triggers saved in DataManager
        Transform  parent        = PartitionManager.Instance.GetInteractableParent(partition);
        GameObject triggerPrefab = (GameObject)Resources.Load(triggerData.PrefabName);
        GameObject trigger       = GameObjectUtils.AddChild(parent.gameObject, triggerPrefab);

        trigger.transform.localPosition = position;

        //keep a local reference
        currentSpawnTriggers.Add(trigger);

        // set the trigger's ID
        DegradTrigger scriptTrigger = trigger.GetComponent <DegradTrigger>();

        scriptTrigger.ID = triggerID;

        return(scriptTrigger);
    }
Beispiel #3
0
    //---------------------------------------------------
    // PlaceTutorialTrigger()
    // Places the lone tutorial trigger, which is the 0th
    // trigger.
    //---------------------------------------------------
    public DegradTrigger PlaceTutorialTrigger()
    {
        List <DegradData> degradTriggers = DegradationLogic.Instance.DegradationTriggers;

        DegradData    degradTrigger = degradTriggers.First();
        DegradTrigger trigger       = PlaceTrigger(degradTrigger);

        trigger.gameObject.name = TUT_TRIGGER;

        return(trigger);
    }