Ejemplo n.º 1
0
    public override void BeginUse(Vector2 location)
    {
        this.IsOn = true;
        whistleSound.Play();

        God.GetStats().incrementStat("whistle_uses", 1);
        God.GetStats().SendData();
    }
Ejemplo n.º 2
0
    public override void BeginUse(Vector2 location)
    {
        this.IsOn = true;
        this.LaserRenderer.enabled = true;
        sound.Play();

        God.GetStats().incrementStat("laser_shots", 1);
        God.GetStats().SendData();
    }
Ejemplo n.º 3
0
    public void ReloadCurrentLevel()
    {
        God.GetStats().incrementStat("attempts", 1);
        God.GetStats().SendData();

        LoadLevel(God.GetCurrentLevel(), false);
        // Handle if we want story to reset as well
        // Should hint level remain?
    }
Ejemplo n.º 4
0
    public void TransitionToNewLevel(string newLevel, bool keepCarried)
    {
        God.GetStats().cleared();
        God.GetStats().SendData();

        God.CloseText();
        LoadLevel(newLevel, keepCarried);
        God.IncrementHintLevel();
    }
Ejemplo n.º 5
0
    public override void BeginUse(Vector2 location)
    {
        this.IsOn = true;
        StartCoroutine(AllowCatPickup());

        // ballSoumd.Play();
        Vector2 direction = location - (Vector2)transform.position;

        this.rb.simulated = true;
        this.rb.velocity  = direction.normalized * GameConstants.BALL_SPEED;
        God.GetPlayer().Bag.Drop(this);
        God.GetPlayer().currentlyEquipped = null;

        // God.GetStats().incrementStat("whistle_uses", 1);
        God.GetStats().SendData();
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        DoInitIfNeeded();
        HandleMiscInputs();
        HandleShowInventory();
        if (!God.IsPaused())
        {
            HandleUsing();
            HandleMotion();
        }
        HandleInteraction();

        if (!God.GetSavior().SaveMode)
        {
            God.GetStats().incrementStat("player_movement", rb.velocity.magnitude * Time.deltaTime);
        }
    }
Ejemplo n.º 7
0
    void HintsButtonOnClick()
    {
        if (canGetHint)
        {
            canGetHint = false;
            if (nextHintNum < HintsList.HINTS_PER_LEVEL)
            {
                God.GetStats().incrementStat("hints", 1);
                God.GetStats().SendData();

                DialogueBox.GetComponentInChildren <Text> ().text = HintsList.ALL_HINTS [level, nextHintNum];
            }
            else
            {
                DialogueBox.GetComponentInChildren <Text> ().text = HintsList.NO_MORE_HINTS;
            }
            DialogueBox.gameObject.SetActive(true);
            WitchPortrait.gameObject.SetActive(false);
            DialoguePortrait.gameObject.SetActive(true);
            nextHintNum += 1;
        }
    }
Ejemplo n.º 8
0
 public void PostLoad()
 {
     God.GetStats().SendData();
 }
Ejemplo n.º 9
0
    public void LoadLevel(string name, bool keepCarried)
    {
        /* Do stats stuff */
        God.SetCurrentLevel(name);
        God.GetStats().initLevel(name);

        Dictionary <string, Dictionary <string, string> > toCarry = Unload();
        //Debug.Log("Carrying " + toCarry.Count + " objects to next scene");
        //foreach(string key in toCarry.Keys)
        //{
        //    Debug.Log("Carrying " + key);
        //}
        Dictionary <string, PersistanceType> typeLookup = new Dictionary <string, PersistanceType>();

        foreach (PersistanceType t in System.Enum.GetValues(typeof(PersistanceType)))
        {
            typeLookup.Add(t.ToString(), t);
        }
        Level lvl = new Level(name).LoadFromPlaythrough();
        Dictionary <string, Dictionary <string, string> > output = lvl.Contents;

        // Merge the dictionaries of the scene & file
        if (keepCarried)
        {
            // For each ID
            foreach (string key in toCarry.Keys)
            {
                if (output.ContainsKey(key))
                {
                    // If that ID is already in the file, go through each property
                    foreach (string innerKey in toCarry[key].Keys)
                    {
                        // And replace the file-property with the scene property
                        output[key][innerKey] = toCarry[key][innerKey];
                    }
                }
                else
                {
                    // If that ID is not in the file, add it from the scene
                    output.Add(key, toCarry[key]);
                }
            }
        }
        List <IPersistantObject> generatedObjects = new List <IPersistantObject>();
        bool usingCompatibility = false;

        foreach (string id in output.Keys)
        {
            Dictionary <string, string> dict = output[id];
            string     t = dict["type"];
            int        num;
            GameObject template;
            if (int.TryParse(t, out num))
            {
                // Allow numbers for backwards compatibility
                template           = _Templates[(PersistanceType)num];
                usingCompatibility = true;
            }
            else
            {
                template = _Templates[typeLookup[dict["type"]]];
            }
            GameObject        loaded      = GameObject.Instantiate(template);
            IPersistantObject persistance = loaded.GetComponent <IPersistantObject>();
            persistance.setID(id);
            if (dict.ContainsKey("transform"))
            {
                persistance.GetMono().transform.UpdateToSaved(dict["transform"]);
            }
            persistance.Load(dict);
            generatedObjects.Add(persistance);
        }
        List <IIdentifiable> identif = new List <IIdentifiable>();

        generatedObjects.ForEach(obj => identif.Add(obj));
        God.UpdateIDLookup(identif);
        generatedObjects.ForEach(obj => obj.PostLoad());
        if (usingCompatibility)
        {
            Debug.Log("WARNING: Using compatibility mode to load level...things may not load as expected");
        }
        lvl.SaveToPlaythrough();
        if (name == GameConstants.OPENING_NARRATIVE_LEVEL)
        {
            God.ShowTexts(HintsList.OPENING_NARRATIVE);
        }
        else if (name == GameConstants.FIRST_MIRROR_LEVEL)
        {
            God.ShowText(HintsList.MIRROR_HINT);
        }
        else if (name == GameConstants.FIRST_GUARD_LEVEL)
        {
            if (!HintsList.GUARDS_SAID)
            {
                God.ShowTexts(HintsList.GUARDS);
                HintsList.GUARDS_SAID = true;
            }
        }
        else if (name == GameConstants.TWO_DOORS_LEVEL)
        {
            God.ShowText(HintsList.TWO_DOORS_HINT);
        }
        else if (name == GameConstants.FINAL_LEVEL)
        {
            StartCoroutine(FinalNarrative());
        }
        else if (name == GameConstants.GAME_END)
        {
            God.ShowText(HintsList.GAME_END_YAY);
        }
    }