Example #1
0
	void Awake()
	{
		_instance = this;	
		if (Application.isPlaying)
		{
			if (soundClips!=null)
			{
				for (int i=0; i<soundClips.Length; i++)
				{
					soundClips[i].Load();
					if (!lookup.ContainsKey(soundClips[i].name.ToLower()))						
						lookup.Add(soundClips[i].name.ToLower(),soundClips[i]);
				}						
			}
		}
	}
Example #2
0
 void Awake()
 {
     _instance = this;
     if (Application.isPlaying)
     {
         if (soundClips != null)
         {
             for (int i = 0; i < soundClips.Length; i++)
             {
                 soundClips[i].Load();
                 if (!lookup.ContainsKey(soundClips[i].name.ToLower()))
                 {
                     lookup.Add(soundClips[i].name.ToLower(), soundClips[i]);
                 }
             }
         }
     }
 }
Example #3
0
    // Use this for initialization
    void Awake()
    {
        instance = this;
		_sound = instance.GetComponent<OTSounds>();
		if (_sound==null)
			_sound = instance.gameObject.AddComponent<OTSounds>();
		
        // find view class as child of the OT main class
        for (int c = 0; c < transform.childCount; c++)
        {
            _view = transform.GetChild(c).gameObject.GetComponent<OTView>();
            if (_view != null)
                break;
        }
        if (view != null) view.InitView();
		
		_world_ = _world;

        if (Application.isPlaying)
        {
            OTObjectType.lookup.Clear();
            for (int o = 0; o < objectPrototypes.Length; o++)
			{
				if (!OTObjectType.lookup.ContainsKey(objectPrototypes[o].name.ToLower()))
                	OTObjectType.lookup.Add(objectPrototypes[o].name.ToLower(), objectPrototypes[o].prototype);
				else
					Debug.LogWarning("duplicate object prototype OT.objectPrototype "+objectPrototypes[o].name);
			}

            // check if we have an OT/Prototypes folder
            for (int c = 0; c < transform.childCount; c++)
            {
                string n = transform.GetChild(c).gameObject.name.ToLower();
                if (n == "prototype" || n == "prototypes")
                {
                    Transform t = transform.GetChild(c);
                    // object prototypes found so add them to the lookup table
                    for (int p = 0; p < t.childCount; p++)
					{
						string na = t.GetChild(p).gameObject.name.ToLower();
						if (!OTObjectType.lookup.ContainsKey(na))
                        	OTObjectType.lookup.Add(na, t.GetChild(p).gameObject);
						else
							Debug.LogWarning("duplicate object prototype : OT.prototypes."+t.GetChild(p).gameObject.name);
						
						if (deactivatePrototypes)
							t.GetChild(p).gameObject.SetActiveRecursively(false);							
					}
                    break;
                }
            }
			
        }
    }