public override void OnLogicStarted(StateMachineComponent stateMachine)
            {
                CinematicCameraMixer camera     = _camera.GetComponent();
                CinematicCameraShot  cameraShot = _shot.GetComponent();

                if (camera != null && cameraShot != null)
                {
                    camera.StartCameraShot(cameraShot, _duration, _extrapolation, _blendTime, _blendEaseType);
                }
            }
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                _playableDirector = _director.GetComponent();

                if (_playableDirector != null)
                {
                    PlayableAsset playable = GetPlayableAsset();
                    _playableDirector.Play(playable, DirectorWrapMode.None);
                }

                return(eEventTriggerReturn.EventOngoing);
            }
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                CinematicCameraMixer camera     = _camera.GetComponent();
                CinematicCameraShot  cameraShot = _shot.GetComponent();

                if (camera != null && cameraShot != null)
                {
                    camera.StartCameraShot(cameraShot, _duration, _extrapolation, _blendTime, _blendEaseType);
                }

                return(eEventTriggerReturn.EventOngoing);
            }
Ejemplo n.º 4
0
            public Material GetMaterial()
            {
                if (_material == null)
                {
                    if (_materialIndex != -1)
                    {
                        if (_materialIndex == kGraphicMaterialIndex)
                        {
                            Graphic graphic = _graphic.GetComponent();

                            if (graphic != null)
                            {
                                _material = graphic.material;
                            }
                        }
                        else
                        {
                            Renderer renderer = _renderer.GetComponent();

                            if (renderer != null && 0 <= _materialIndex && _materialIndex < renderer.sharedMaterials.Length)
                            {
                                _material = renderer.materials[_materialIndex];
                            }
                        }
                    }
                    else
                    {
                        _material = _materialRef.LoadAsset();
                    }
                }

                return(_material);
            }
Ejemplo n.º 5
0
            public PathPosition GetPathPosition()
            {
                Path     path     = _path.GetComponent();
                PathNode pathNode = _pathNode.GetComponent();

                if (path != null)
                {
                    if (pathNode == null)
                    {
                        return(path.GetPoint(_pathT));
                    }
                    else
                    {
                        return(path.GetPoint(path.GetPathT(pathNode)));
                    }
                }

                return(null);
            }
Ejemplo n.º 6
0
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                MonoBehaviour target = _target.GetComponent();

                if (target != null)
                {
                    target.enabled = _enabled;
                }

                return(eEventTriggerReturn.EventFinished);
            }
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                PlayableDirector director = _director.GetComponent();

                if (director != null)
                {
                    director.Stop();
                }

                return(eEventTriggerReturn.EventFinished);
            }
Ejemplo n.º 8
0
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                IAnimator target = _animator.GetComponent();

                if (target != null)
                {
                    target.Stop(_channel, _blendTime, _easeType);
                }

                return(eEventTriggerReturn.EventFinished);
            }
Ejemplo n.º 9
0
            public T RunMethod()
            {
                T returnObj = default(T);

                Component component = _component.GetComponent();

                if (component != null)
                {
                    if (_method == null)
                    {
                        _method = component.GetType().GetMethod(_methodName);
                    }

                    if (_method != null)
                    {
                        returnObj = (T)_method.Invoke(component, null);
                    }
                }

                return(returnObj);
            }
Ejemplo n.º 10
0
            public bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged = false;

                if (label == null)
                {
                    label = new GUIContent();
                }

                label.text += " (" + this + ")";

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label);

                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;

                    _animator = SerializationEditorGUILayout.ObjectField(_animator, new GUIContent("Animator"), ref dataChanged);

                    IAnimator animator = _animator.GetComponent();

                    if (animator != null)
                    {
                        string[] animationNames = animator.GetAnimationNames();
                        int      currentIndex   = -1;

                        for (int i = 0; i < animationNames.Length; i++)
                        {
                            if (animationNames[i] == _animationId)
                            {
                                currentIndex = i;
                                break;
                            }
                        }

                        int index = EditorGUILayout.Popup("Animation", currentIndex == -1 ? 0 : currentIndex, animationNames);

                        if (currentIndex != index)
                        {
                            _animationId = animationNames[index];
                            dataChanged  = true;
                        }
                    }

                    EditorGUI.indentLevel = origIndent;
                }

                return(dataChanged);
            }
Ejemplo n.º 11
0
            public override IEnumerator PerformState(StateMachineComponent stateMachine)
            {
                PlayableDirector director = _director.GetComponent();
                PlayableAsset    playable = _playableAsset.LoadAsset();

                if (director != null && playable != null)
                {
                    director.Play(playable, DirectorWrapMode.None);

                    while (director.playableGraph.IsValid() && !director.playableGraph.IsDone())
                    {
                        yield return(null);
                    }
                }

                stateMachine.GoToState(StateMachine.Run(stateMachine, _goToState));
            }
Ejemplo n.º 12
0
            public override void OnStartConditionChecking(StateMachineComponent stateMachine)
            {
                _playableDirector = _director.GetComponent();

                if (_playableDirector != null)
                {
                    if (_playableAsset.IsValid())
                    {
                        PlayableAsset playable = _playableAsset.LoadAsset();
                        _playableDirector.Play(playable, _wrapMode);
                    }
                    else
                    {
                        _playableDirector.Play(_playableDirector.playableAsset, _wrapMode);
                    }
                }
            }
Ejemplo n.º 13
0
            public T RunMethod()
            {
                T returnObj = default(T);

                Component component = _object.GetComponent();

                if (component != null)
                {
                    MethodInfo method = component.GetType().GetMethod(_methodName);

                    if (method != null)
                    {
                        returnObj = (T)method.Invoke(component, null);
                    }
                }

                return(returnObj);
            }
Ejemplo n.º 14
0
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                IFadable target = _target.GetComponent();

                if (target != null)
                {
                    if (_active)
                    {
                        target.FadeIn(_fadeTime);
                    }
                    else
                    {
                        target.FadeOut(_fadeTime);
                    }
                }

                return(eEventTriggerReturn.EventFinished);
            }
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                PlayableDirector director = _director.GetComponent();

                if (director != null)
                {
                    if (_playableAsset.IsValid())
                    {
                        PlayableAsset playable = _playableAsset.LoadAsset();
                        director.Play(playable, _wrapMode);
                    }
                    else
                    {
                        director.Play(director.playableAsset, _wrapMode);
                    }
                }

                return(eEventTriggerReturn.EventFinished);
            }
 public void OnStartConditionChecking(StateMachine stateMachine)
 {
     _stateMachineObj = _stateMachine.GetComponent();
 }
Ejemplo n.º 17
0
 protected override Component GetStaticValue()
 {
     return(_value.GetComponent());
 }
 public override void OnStartConditionChecking(StateMachineComponent stateMachine)
 {
     _stateMachineObj = _stateMachine.GetComponent();
 }
 protected override Transform GetStaticValue()
 {
     return(_value.GetComponent());
 }
Ejemplo n.º 20
0
                public static object PropertyField(object obj, GUIContent label, ref bool dataChanged, GUIStyle style, params GUILayoutOption[] options)
                {
                    MaterialRef materialRef = (MaterialRef)obj;

                    if (label == null)
                    {
                        label = new GUIContent();
                    }

                    label.text += " (" + materialRef + ")";

                    bool editorCollapsed = !EditorGUILayout.Foldout(!materialRef._editorCollapsed, label);

                    if (editorCollapsed != materialRef._editorCollapsed)
                    {
                        materialRef._editorCollapsed = editorCollapsed;
                        dataChanged = true;
                    }

                    if (!editorCollapsed)
                    {
                        int origIndent = EditorGUI.indentLevel;
                        EditorGUI.indentLevel++;

                        eEdtiorType editorType = materialRef.GetMaterialIndex() == -1 ? eEdtiorType.Shared : eEdtiorType.Instanced;


                        //Draw type dropdown
                        {
                            EditorGUI.BeginChangeCheck();
                            editorType = (eEdtiorType)EditorGUILayout.EnumPopup("Material Type", editorType);

                            if (EditorGUI.EndChangeCheck())
                            {
                                dataChanged = true;
                                materialRef = new MaterialRef(editorType == eEdtiorType.Shared ? -1 : 0);
                            }
                        }

                        //Draw renderer field
                        if (editorType == eEdtiorType.Instanced)
                        {
                            bool renderChanged = false;
                            ComponentRef <Renderer> rendererComponentRef = SerializationEditorGUILayout.ObjectField(materialRef.GetRenderer(), new GUIContent("Renderer"), ref renderChanged);

                            if (renderChanged)
                            {
                                dataChanged = true;
                                materialRef = new MaterialRef(rendererComponentRef, 0);
                            }

                            //Show drop down for materials
                            Renderer renderer = rendererComponentRef.GetComponent();

                            if (renderer != null)
                            {
                                string[] materialNames = new string[renderer.sharedMaterials.Length];

                                for (int i = 0; i < materialNames.Length; i++)
                                {
                                    materialNames[i] = renderer.sharedMaterials[i].name;
                                }

                                EditorGUI.BeginChangeCheck();
                                int materialIndex = EditorGUILayout.Popup("Material", materialRef.GetMaterialIndex(), materialNames);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    dataChanged = true;
                                    materialRef = new MaterialRef(rendererComponentRef, materialIndex);
                                }
                            }
                        }
                        else
                        {
                            bool assetChanged            = false;
                            AssetRef <Material> assetRef = SerializationEditorGUILayout.ObjectField(materialRef.GetAsset(), new GUIContent("Material"), ref assetChanged);

                            if (assetChanged)
                            {
                                dataChanged = true;
                                materialRef = new MaterialRef(assetRef);
                            }
                        }

                        EditorGUI.indentLevel = origIndent;
                    }


                    return(materialRef);
                }
Ejemplo n.º 21
0
 public IAnimator GetAnimator()
 {
     return(_animator.GetComponent());
 }
Ejemplo n.º 22
0
            public eEventTriggerReturn Trigger(StateMachineComponent stateMachine)
            {
                AnimatedCamera camera = _camera;

                if (camera != null)
                {
                    AnimatedCamera.Animation animation = new AnimatedCamera.Animation(_snapshot.GetComponent().GetState());
                    camera.SetAnimation(animation, _blendEaseType, _blendTime);
                }

                return(eEventTriggerReturn.EventFinished);
            }