Exemplo n.º 1
0
        /// <summary>
        /// attempt to generate the missing targets
        /// </summary>
        void AMITarget.GenerateMissingTargets(string[] missingPaths)
        {
            if (missingPaths != null && missingPaths.Length > 0)
            {
                for (int i = 0; i < missingPaths.Length; i++)
                {
                    AMUtil.CreateTarget(transform, missingPaths[i]);
                }

                //fill necessary components per track and key
                foreach (AMTakeData take in _takes)
                {
                    foreach (AMTrack track in take.trackValues)
                    {
                        Transform t = AMUtil.GetTarget(transform, track.targetPath);

                        System.Type compType = track.GetRequiredComponent();
                        if (compType != null)
                        {
                            Component comp = t.gameObject.GetComponent(compType);
                            if (comp == null)
                            {
                                t.gameObject.AddComponent(compType);
                            }
                        }

                        foreach (AMKey key in track.keys)
                        {
                            compType = key.GetRequiredComponent();
                            if (compType != null)
                            {
                                Component comp = t.gameObject.GetComponent(compType);
                                if (comp == null)
                                {
                                    t.gameObject.AddComponent(compType);
                                }
                            }
                        }
                    }
                }

                if (mCache != null)
                {
                    mCache.Clear();
                }
            }
        }