Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        StaticInits.Start();
        SaveLoad.Start();
        new ControlPanel();
        new PlayerCharacter();
        #if UNITY_STANDALONE_WIN || UNITY_EDITOR
        if (GlobalControls.crate)
        {
            Misc.WindowName = ControlPanel.instance.WinodwBsaisNmae;
        }
        else
        {
            Misc.WindowName = ControlPanel.instance.WindowBasisName;
        }
        #endif
        SaveLoad.LoadAlMighty();
        MisriHalek       = GameObject.Find("MisriHalek").GetComponent <Image>();
        MainText         = FindObjectOfType <Text>();
        MainAudio        = Camera.main.GetComponent <AudioSource>();
        SubAudio         = GameObject.Find("SubAudio").GetComponent <AudioSource>();
        MainSprite       = ((LuaSpriteController)SpriteUtil.MakeIngameSprite("empty", "none", -1).UserData.Object);
        MainSprite.alpha = 0;
        MainSprite.SetPivot(.5f, 0);
        MainSprite.absy = 260;

        Sprite[] sprs = Resources.LoadAll <Sprite>("Sprites/Punder");
        foreach (Sprite spr in sprs)
        {
            Sprites.Add(spr.name, spr);
        }
        AudioClip[] adcs = Resources.LoadAll <AudioClip>("Audios");
        foreach (AudioClip adc in adcs)
        {
            Audios.Add(adc.name, adc);
        }
        MainAudio.clip = Audios["MisriHalek"];
        MainAudio.loop = false;
        MainAudio.Play();
        //MainAudio.time = 137;
        clipSampleData = new float[sampleDataLength];
    }
    // Use this for initialization
    void Start()
    {
        // Load CYF's save file
        StaticInits.Start();
        SaveLoad.Start();

        // Set up CYF's basic objects
        new ControlPanel();
        new PlayerCharacter();
        #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
        if (GlobalControls.crate)
        {
            Misc.WindowName = ControlPanel.instance.WinodwBsaisNmae;
        }
        else
        {
            Misc.WindowName = ControlPanel.instance.WindowBasisName;
        }
        #endif
        // Load CYF's AlMighty save file
        SaveLoad.LoadAlMighty();

        // Store useful scene objects
        misriHalek = GameObject.Find("MisriHalek").GetComponent <Image>();
        mainText   = GameObject.Find("MainText").GetComponent <Text>();
        subText    = GameObject.Find("SubText").GetComponent <Text>();
        mainAudio  = Camera.main.GetComponent <AudioSource>();
        subAudio   = GameObject.Find("SubAudio").GetComponent <AudioSource>();

        // Load all resources needed for this animation to play
        Sprite[] punderSprs = Resources.LoadAll <Sprite>("Sprites/Punder");
        foreach (Sprite spr in punderSprs)
        {
            punderSprites.Add(spr.name, spr);
        }

        Sprite[] luSprs = Resources.LoadAll <Sprite>("Sprites/Lu");
        foreach (Sprite spr in luSprs)
        {
            luSprites.Add(spr.name, spr);
        }

        AudioClip[] adcs = Resources.LoadAll <AudioClip>("Audios");
        foreach (AudioClip adc in adcs)
        {
            audioFiles.Add(adc.name, adc);
        }

        // Create all sprites needed for the animation
        mainSprite       = (LuaSpriteController)SpriteUtil.MakeIngameSprite("empty", "Default", -1).UserData.Object;
        mainSprite.alpha = 0;
        mainSprite.SetPivot(.5f, 0);
        mainSprite.x = 0;
        mainSprite.y = 20;

        fadeSprite       = (LuaSpriteController)SpriteUtil.MakeIngameSprite("black", "Default", -1).UserData.Object;
        fadeSprite.alpha = 0;

        pauseSprite = (LuaSpriteController)SpriteUtil.MakeIngameSprite("empty", "Default", -1).UserData.Object;
        SetSprite(Resources.Load <Sprite>("Sprites/pause"), "", pauseSprite);
        pauseSprite.alpha = 0;

        subSprite   = (LuaSpriteController)SpriteUtil.MakeIngameSprite("empty", "Lu", -1).UserData.Object;
        subSprite.x = 0;
        subSprite.y = -400;
        SetSprite("HoldNormal0", false);

        // Preload all other audio files to prevent lag spikes
        foreach (AudioClip clip in audioFiles.Values)
        {
            mainAudio.clip = clip;
            mainAudio.Play();
        }
        mainAudio.clip = audioFiles["MisriHalek"];
        mainAudio.loop = false;
        mainAudio.Play();

        clipSampleData = new float[sampleDataLength];
    }
Exemplo n.º 3
0
    void Start()
    {
        if (Inventory.inventory.Count == 0 && ItemBox.items.Count == 0)
        {
            System.Random rnd   = new System.Random();
            string[]      words = new string[] { "effort", "time", "feeling" };

            Table text = new Table(EventManager.instance.luainvow.appliedScript.script);
            text.Set(DynValue.NewNumber(1), DynValue.NewString("You have no items.[w:10]\nYou put a little " + words[rnd.Next(0, 3)] + "\rinto the box."));

            EventManager.instance.luagenow.SetDialog(DynValue.NewTable(text));
            Destroy(this);
            return;
        }

        active = true;

        GetComponent <Image>().color = new Color(1, 1, 1, 1);

        player = GameObject.Find("utHeartMenu");
        Color c = player.GetComponent <Image>().color;

        player.GetComponent <Image>().color = new Color(c.r, c.g, c.b, 1);

        for (int i = 0; i < Inventory.inventorySize; i++)
        {
            GameObject go = new GameObject();
            go.AddComponent <RectTransform>();
            go.AddComponent <TextManager>();
            TextManager tm = go.GetComponent <TextManager>();
            tm.transform.SetParent(transform);
            tm.transform.position = new Vector3(80, 410 - (i * 32));
            inventory.Add(tm);

            LuaSpriteController sprite = (LuaSpriteController)(SpriteUtil.MakeIngameSprite("px", -1).UserData.Object);
            sprite._img.transform.SetParent(transform);
            sprite.SetPivot(0, 0.5f);
            sprite.MoveToAbs(92, 386 - (i * 32));
            sprite.xscale = 190;
            sprite.color  = new float[] { 1f, 0f, 0f };
            inventorySprites.Add(sprite);
        }

        for (int i = 0; i < ItemBox.capacity; i++)
        {
            GameObject go = new GameObject();
            go.AddComponent <RectTransform>();
            go.AddComponent <TextManager>();
            TextManager tm = go.GetComponent <TextManager>();
            tm.transform.SetParent(transform);
            tm.transform.position = new Vector3(372, 410 - (i * 32));
            boxContents.Add(tm);

            LuaSpriteController sprite = (LuaSpriteController)(SpriteUtil.MakeIngameSprite("px", -1).UserData.Object);
            sprite._img.transform.SetParent(transform);
            sprite.SetPivot(0, 0.5f);
            sprite.MoveToAbs(384, 386 - (i * 32));
            sprite.xscale = 190;
            sprite.color  = new float[] { 1f, 0f, 0f };
            boxContentsSprites.Add(sprite);
        }
        RefreshDisplay();
    }