public override void OnInspectorGUI()
        {
            Kennith_Model model = (Kennith_Model)target;

            if (GUILayout.Button("Throw Spirit Bomb"))
            {
                model.ChangeState(model.spiritBombState);
            }

            if (GUILayout.Button("Throw Hail Attack"))
            {
                model.ChangeState(model.hailState);
            }

            if (GUILayout.Button("Go Idle"))
            {
                model.ChangeState(model.idleState);
            }

            if (GUILayout.Button("Move Around"))
            {
                model.ChangeState(model.moveState);
            }

            if (GUILayout.Button("FLEE"))
            {
                model.ChangeState(model.fleeState);
            }

            if (GUILayout.Button("Perish"))
            {
                model.ChangeState(model.deathState);
            }

            DrawDefaultInspector();
        }
예제 #2
0
 private void Awake()
 {
     model  = GetComponentInParent <Kennith_Model>();
     energy = GetComponentInParent <Energy>();
 }
예제 #3
0
 private void Awake()
 {
     model = GetComponentInParent <Kennith_Model>();
     dist  = model.turningDistance;
     body  = GetComponentInParent <Rigidbody>();
 }
        private void OnGUI()
        {
            if (Selection.activeGameObject == null)
            {
                GUILayout.Label("Select a Kennith-type AI to control");
                return;
            }

            model = Selection.activeGameObject.GetComponent <Kennith_Model>();

            if (model == null)
            {
                GUILayout.Label("Select a Kennith-type AI to control");
                return;
            }

            if (GUILayout.Button("Throw Spirit Bomb"))
            {
                if (model != null)
                {
                    if (!Application.isPlaying)
                    {
                        Debug.LogWarning("Editor must be playing for this button to function");
                    }
                    else
                    {
                        model.ChangeState(model.spiritBombState);
                    }
                }
                else
                {
                    Debug.LogError("Selected Object does not have required component");
                }
            }

            if (GUILayout.Button("Throw Hail Attack"))
            {
                if (model != null)
                {
                    if (!Application.isPlaying)
                    {
                        Debug.LogWarning("Editor must be playing for this button to function");
                    }
                    else
                    {
                        model.ChangeState(model.hailState);
                    }
                }
                else
                {
                    Debug.LogError("Selected Object does not have required component");
                }
            }

            if (GUILayout.Button("Go Idle"))
            {
                if (model != null)
                {
                    if (!Application.isPlaying)
                    {
                        Debug.LogWarning("Editor must be playing for this button to function");
                    }
                    else
                    {
                        model.ChangeState(model.idleState);
                    }
                }
                else
                {
                    Debug.LogError("Selected Object does not have required component");
                }
            }

            if (GUILayout.Button("Move Around"))
            {
                if (model != null)
                {
                    if (!Application.isPlaying)
                    {
                        Debug.LogWarning("Editor must be playing for this button to function");
                    }
                    else
                    {
                        model.ChangeState(model.moveState);
                    }
                }
                else
                {
                    Debug.LogError("Selected Object does not have required component");
                }
            }

            if (GUILayout.Button("FLEE"))
            {
                if (model != null)
                {
                    if (!Application.isPlaying)
                    {
                        Debug.LogWarning("Editor must be playing for this button to function");
                    }
                    else
                    {
                        model.ChangeState(model.fleeState);
                    }
                }
                else
                {
                    Debug.LogError("Selected Object does not have required component");
                }
            }

            if (GUILayout.Button("Perish"))
            {
                if (model != null)
                {
                    if (!Application.isPlaying)
                    {
                        Debug.LogWarning("Editor must be playing for this button to function");
                    }
                    else
                    {
                        model.ChangeState(model.deathState);
                    }
                }
                else
                {
                    Debug.LogError("Selected Object does not have required component");
                }
            }
        }