Exemplo n.º 1
0
    private Fade fade;                                   // Use this to fade text in / out

    // Set default values, start idle coroutine
    void Start()
    {
        rangeCollider        = gameObject.GetComponent <CircleCollider2D>();
        rangeCollider.radius = range;

        eventTitleText       = transform.parent.Find("TextCanvas").Find("EventTitleText").GetComponent <Text>();
        eventTitleText.color = new Color(eventTitleText.color.r, eventTitleText.color.g, eventTitleText.color.b, 0);

        fade = Fade.CreateFade(gameObject);

        StartCoroutine(Idle());
    }
Exemplo n.º 2
0
    void Spawn()
    {
        GameObject go = Instantiate(prefabToSpawn, positionToSpawn, Quaternion.identity);

        fade = Fade.CreateFade(go, fadeDuration);

        SpriteRenderer sr = go.GetComponent <SpriteRenderer>();

        sr.color = new Color(sr.color.r, sr.color.g, sr.color.b, 0f);
        fade.FadeInSprite(go.GetComponent <SpriteRenderer>());
        Destroy(gameObject);
    }
Exemplo n.º 3
0
    // TESTING ONLY

    /*void Update() {
     *  if (Input.GetKeyDown(KeyCode.Alpha1)) {
     *      SampleKeyItem temp = new SampleKeyItem();
     *      temp.itemName = "Test Item";
     *      AddItem(temp);
     *  }
     * }*/

    // Only one instance of this should exist to prevent duplicating items to the UI
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            fade     = Fade.CreateFade(gameObject);
            //SaveData.Load();  This will be done by the GameManager
        }
        else
        {
            Destroy(this);
        }
    }
Exemplo n.º 4
0
    IEnumerator End()
    {
        fade       = Fade.CreateFade(gameObject, 3);
        text       = gameObject.GetComponent <Text>();
        text.color = new Color(text.color.r, text.color.g, text.color.b, 0);
        yield return(new WaitForSeconds(1));

        fade.FadeInText(text);
        yield return(new WaitForSeconds(6));

        fade.FadeOutText(text);
        yield return(new WaitForSeconds(5));

        SceneManager.LoadScene(Scenes.MainMenu.ToString());
    }
Exemplo n.º 5
0
    public string KeyName;  // Key required to open the door

    public override IEnumerator TriggerEvent()
    {
        if (Inventory.Contains(KeyName))
        {
            // Deactivate Trigger
            DeactivateEventTrigger();

            // Open the door
            Fade       fade   = Fade.CreateFade(gameObject);
            GameObject sprite = gameObject.transform.Find("Sprite").gameObject;
            fade.FadeOutSprite(sprite.GetComponent <SpriteRenderer>(), 2);
            yield return(new WaitForSeconds(1));

            //Destroy the nav obstacle
            Destroy(sprite.transform.Find("NavObstacle").gameObject);

            yield break;
        }
    }
Exemplo n.º 6
0
    //One time events must
    //  1) Call DeactivateTrigger() to immediately disable the event
    //  2) Call Completed() to notify the save system that the event should not be re-loaded
    public override IEnumerator TriggerEvent()
    {
        DeactivateTrigger();    // Required
        if (item)
        {
            Inventory.AddItem(item);
        }
        popup.text = "Acquired [" + item.itemName + "].";
        RectTransform rt = popup.gameObject.GetComponent <RectTransform>();

        rt.position = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 10));
        fade        = Fade.CreateFade(gameObject);
        fade.FadeInText(popup);
        yield return(new WaitForSeconds(3));

        fade.FadeOutText(popup);

        Completed();    // Required
        yield break;
    }
Exemplo n.º 7
0
 void Awake()
 {
     fade               = Fade.CreateFade(gameObject, 0.5f);
     itemNameText       = gameObject.transform.Find("ItemNameText").gameObject.GetComponent <Text>();
     itemNameText.color = new Color(itemNameText.color.r, itemNameText.color.g, itemNameText.color.b, 0);
 }