示例#1
0
    private void ToggleBool()
    {
        Variable var = ObjectController.Get().GetObject <Variable>(ObjectCategories.Variable, Name);

        var.Value = TypeConversion.Convert(typeof(bool), Value.ToString());
        Debug.Log("Bool Toggled: " + var.Name + " Value: " + var.Value.ToString());
    }
示例#2
0
    private void SetValue()
    {
        Variable var = ObjectController.Get().GetObject <Variable>(ObjectCategories.Variable, Name);

        var.Value = Value;
        Debug.Log("Value Set: " + var.Name + " Value: " + var.Value.ToString());
    }
示例#3
0
    private void IncrementValue()
    {
        Variable var = ObjectController.Get().GetObject <Variable>(ObjectCategories.Variable, Name);

        var.Value = (float)var.Value + Value;
        Debug.Log("Value Incremented: " + var.Name + " Value: " + var.Value.ToString());
    }
 private void CheckForValueOrName()
 {
     Var = ObjectController.Get().GetObject <Variable>(ObjectCategories.Variable, Name);
     if (Val == null)
     {
         Comparer = (float)TypeConversion.Convert(typeof(float), Value);
     }
 }
示例#5
0
    private void StopSound()
    {
        GameObject actor = GameObject.Find(Actor);

        AudioSource[] aSources = actor.GetComponents <AudioSource>();
        SoundObj      sound    = ObjectController.Get().GetObject <SoundObj>(ObjectCategories.Sound, Name);

        for (int i = 0; i < aSources.Length; ++i)
        {
            if (aSources[i].clip.name == sound.Sound.name)
            {
                aSources[i].Stop();
            }
        }
    }
示例#6
0
    public void Init()
    {
        ObjectController controller = ObjectController.Get();

        foreach (Variable var in Variables)
        {
            controller.AddObject(ObjectCategories.Variable, var);
        }
        foreach (SoundObj sound in Sounds)
        {
            Debug.Log("Pushing " + sound.Name + " to ObjectController.");
            controller.AddObject(ObjectCategories.Sound, sound);
        }
        foreach (Timer timer in Timers)
        {
            TimerManager.Get().RegisterTimer(timer);
        }
        Variables.Clear();
        Sounds.Clear();
        Timers.Clear();
    }
示例#7
0
    private void PlaySound()
    {
        SoundObj   sound = ObjectController.Get().GetObject <SoundObj>(ObjectCategories.Sound, Name);
        GameObject actor = GameObject.Find(Actor);

        if (sound == null)
        {
            Debug.LogError("Cannot find sound: " + Name);
            //Debug.Break();
        }
        if (actor == null)
        {
            Debug.LogError("Cannot find actor: " + Actor);
            //Debug.Break();
        }

        try
        {
            Debug.Log("Within PlaySound try block");
            AudioSource aSource;

            if (actor.audio && !actor.audio.isPlaying)
            {
                aSource = actor.audio;
            }
            else
            {
                aSource = actor.AddComponent <AudioSource>();
            }

            aSource.loop = Loop;
            aSource.clip = sound.Sound;
            aSource.Play();
        }
        catch { } // We already know what this could be, we don't care, dev will get the warning in console already.
    }