Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            this.timer1.Interval = 50;
            this.timer1.Enabled  = true;

            this.Width          = WIDTH;
            this.Height         = HEIGHT;
            this.DoubleBuffered = true;

            this.cameraState = CameraState.Default;

            this.keyboardState = new KeyboardState();

            // Define axes
            x_axis = new AxisX(3);
            y_axis = new AxisY(3);
            z_axis = new AxisZ(3);

            this.cube = new Cube(Color.Purple);

            this.cubeController = new CubeController();

            this.animationEngine           = new AnimationEngine(this.cameraState, this.cubeController);
            this.animationEngine.Finished += ResetAnimation;
        }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     agent      = GetComponent <NavMeshAgent>();
     animEngine = GetComponent <AnimationEngine> ();
     animEngine.setSitting(false);
     animEngine.animator.SetTrigger("IdleTrigger");
 }
Ejemplo n.º 3
0
    //public void Init (AnimationAnalyzer animAnalyzer, AnimationEngine animEngine, FootstepPlanningTest planner,
    public void Init(AnimationAnalyzer animAnalyzer, AnimationEngine animEngine, Planner planner,
                     NeighbourAgents agents, NeighbourObstacles obstacles, CollisionReaction colReact)
    {
        analyzer = animAnalyzer;
        if (analyzer != null && !analyzer.initialized)
        {
            analyzer.Init();
        }

        planning = planner;
        if (planning != null && !planning.initialized)
        {
            planning.Init(analyzer, agents, obstacles);
        }

        engine = animEngine;
        if (engine != null && !engine.initialized)
        {
            engine.Init(analyzer, planning, agents, obstacles);
        }

        collision = colReact;
        if (collision != null && !collision.initialized)
        {
            collision.Init(analyzer, planning, engine, agents, obstacles);
        }

        if (debugText != null)
        {
            debugText.gameObject.active = false;
        }

        initialized = true;
    }
Ejemplo n.º 4
0
        private bool DoPlayerAnimEnginesMatch()
        {
            AnimationEngine animationEngine = AnimationEngine.Legacy;
            bool            foundFirst      = false;

            foreach (PlayerPrefab _player in players)
            {
                if (_player.playerOb != null)
                {
                    if (!foundFirst)
                    {
                        foundFirst      = true;
                        animationEngine = _player.playerOb.animationEngine;
                    }
                    else
                    {
                        if (_player.playerOb.animationEngine != animationEngine)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 5
0
 void PopulateChildren(ModelNode node, Model3DNode orin, Model model, AnimationEngine engine, List <ModelNode> allNodes)
 {
     allNodes.Add(node);
     if (engine.HeadBones.Contains(node.Name))
     {
         node.Mode = 0;
     }
     else if (engine.LegBones.Contains(node.Name))
     {
         node.Mode = 2;
     }
     else
     {
         node.Mode = 1;
     }
     for (int i = 0; i < orin.Children.Count; i++)
     {
         ModelNode child = new ModelNode()
         {
             Parent = node, Name = orin.Children[i].Name.ToLowerFast()
         };
         PopulateChildren(child, orin.Children[i], model, engine, allNodes);
         node.Children.Add(child);
     }
 }
Ejemplo n.º 6
0
        private void CreateRotateAnimation(StrokeCollection strokes, Point centerOffset, Point from, Point to)
        {
            Rect         bound = strokes.GetBounds();
            AnimationObj obj   = AnimationEngine.AddDurationActionAnimation(strokes, AnimationActionType.Rotate, centerOffset, 5, from, to, true);

            obj.Begin();
        }
    public void Start()
    {
//		foreach (Transform t in transform){
//			if (t.gameObject.name.Equals("mixamorig:Hips")){
//				torkanaTrans = t;
//				break;
//			}
//		}
        torkanaTrans    = transform;
        playerTrans     = player;
        agentDests      = new Vector3[numDests];
        agent           = GetComponent <NavMeshAgent>();
        animationEngine = GetComponent <AnimationEngine> ();
        currIndex       = 0;
        //Iterate over the children of the pathPointers object
        foreach (Transform pointer in pathPointers)
        {
            agentDests[currIndex] = pointer.position;
            currIndex++;
        }

        numDests  = currIndex;
        currIndex = 0;
        //	lockTorkana = false;
        previousLocation = torkanaTrans.position;
        //InvokeRepeating ("moveTorkana", 0, 0.1f);
        isActive = true;
    }
Ejemplo n.º 8
0
 /// <summary>
 /// Prepares the model system.
 /// </summary>
 /// <param name="engine">Animation engine.</param>
 /// <param name="tclient">Backing client.</param>
 public void Init(AnimationEngine engine, GameClientWindow tclient)
 {
     TheClient    = tclient;
     AnimEngine   = engine;
     Handler      = new ModelHandler();
     LoadedModels = new Dictionary <string, Model>(128);
     AddDefaults();
 }
Ejemplo n.º 9
0
    //public void Init(AnimationAnalyzer analyzer, FootstepPlanningTest planner,
    public void Init(AnimationAnalyzer analyzer, Planner planner,
                     AnimationEngine animEngine, CollisionReaction collisionReact,
                     NavMeshWayPoints navMeshWaypoints, SteeringManager steering,
                     NeighbourAgents agents, NeighbourObstacles obstacles,
                     PlaceFootSteps steps)
    {
        planning = planner;
        if (planning != null && !planning.initialized)
        {
            planning.Init(analyzer, agents, obstacles);
        }

        engine = animEngine;
        if (engine != null && !engine.initialized)
        {
            engine.Init(analyzer, planning, agents, obstacles);
        }

        collision = collisionReact;
        if (collision != null && !collision.initialized)
        {
            collision.Init(analyzer, planner, engine, agents, obstacles);
        }

        waypoints = navMeshWaypoints;
        //if (waypoints != null && !waypoints.initialized)
        //	waypoints.Init(planning,steering,analyzer,agents,obstacles);

        neighborhood = agents;
        if (neighborhood != null && !neighborhood.initialized)
        {
            neighborhood.Init();
        }

        footsteps = steps;
        if (footsteps != null && !footsteps.initiated)
        {
            footsteps.Init(analyzer, planner, engine, neighborhood, obstacles);
        }

        nObstacles = obstacles;
        if (nObstacles != null && !nObstacles.initialized)
        {
            nObstacles.Init();
        }

        timeSinceLastPlan      = 0;
        timeSinceLastWaypoints = 0;

        previousGoalPosition        = planning.goalStateTransform.position;
        previousCurrentGoalPosition = planning.currentGoal;

        previousActionsSinceLastPlan = -1;

        newWaypoint = false;

        initialized = true;
    }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     //Initialize some values
     previousLocation = transform.position;
     agent            = GetComponent <NavMeshAgent>();
     animationEngine  = GetComponent <AnimationEngine> ();
     animationEngine.setHasLimp(hasLimp);
     InvokeRepeating("calculateRandomPoint", 0, updateTime);
 }
Ejemplo n.º 11
0
 void selector_SelectedEvent(object sender, OptionArg e)
 {
     AnimationEngine.Resume();
     this.lasso.ClearLassco();
     if (this.strokesWillDoAnimation != null)
     {
         this.SwithAnimation(e.Option);
     }
 }
Ejemplo n.º 12
0
        private void ResetAnimationEngine(AnimationEngine animationEngine)
        {
            string className = "AnimEngine_" + animationEngine.ToString();

            if (editingAnimEngine == null || editingAnimEngine.ToString() != className)
            {
                editingAnimEngine = (AnimEngine)ScriptableObject.CreateInstance(className);
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Prepares the model system.
 /// </summary>
 public void Init(AnimationEngine engine)
 {
     AnimEngine   = engine;
     Handler      = new ModelHandler();
     LoadedModels = new List <Model>();
     Cube         = FromBytes("cube", FileHandler.encoding.GetBytes(ModelHandler.CubeData));
     Cylinder     = FromBytes("cylinder", FileHandler.encoding.GetBytes(ModelHandler.CylinderData));
     LoadedModels.Add(Cube);
     LoadedModels.Add(Cylinder);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Prepares the model system.
 /// </summary>
 public void Init(AnimationEngine engine, Client tclient)
 {
     TheClient    = tclient;
     AnimEngine   = engine;
     Handler      = new ModelHandler();
     LoadedModels = new List <Model>();
     Cube         = GetModel("cube");
     Cylinder     = GetModel("cylinder");
     Sphere       = GetModel("sphere");
 }
Ejemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     agent                  = GetComponent <NavMeshAgent> ();
     previousLocation       = transform.position;
     agent.stoppingDistance = stoppingDistance;
     animationEngine        = GetComponent <AnimationEngine> ();
     //animationEx.setMoveSpeed(1.0f);
     //animator = GetComponent<Animator> ();
     //currentAnimation = this.animation;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Prepares the model system.
 /// </summary>
 /// <param name="engine">Animation engine.</param>
 /// <param name="tclient">Backing client.</param>
 public void Init(AnimationEngine engine, GameClientWindow tclient)
 {
     TheClient    = tclient;
     AnimEngine   = engine;
     Handler      = new ModelHandler();
     LoadedModels = new Dictionary <string, Model>(128);
     Cube         = GenerateCube();
     LoadedModels.Add("cube", Cube);
     Cylinder = GetModel("cylinder");
     Sphere   = GetModel("sphere");
 }
Ejemplo n.º 17
0
        void CreateFlashAnimation(StrokeCollection strokes)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(bound.Left + bound.Width / 2, bound.Top + bound.Height / 2);

            AnimationLibrary.Current.GetFlashAnimationSync(bound, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Translate, center, from, to);
                obj.Begin();
            });
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Prepares the model system.
 /// </summary>
 /// <param name="engine">Animation engine.</param>
 /// <param name="tclient">Backing client.</param>
 public void Init(AnimationEngine engine, GameClientWindow tclient)
 {
     TheClient    = tclient;
     AnimEngine   = engine;
     Handler      = new ModelHandler();
     LoadedModels = new List <Model>();
     Cube         = GenerateCube();
     LoadedModels.Add(Cube);
     Cylinder = GetModel("cylinder");
     Sphere   = GetModel("sphere");
 }
Ejemplo n.º 19
0
        private void CreateShakeAnimation(StrokeCollection strokes, AOrientation oritation)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(bound.Left + bound.Width / 2, bound.Top + bound.Height / 2);

            AnimationLibrary.Current.GetShakeAnimationSync(bound, oritation, 5, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Translate, center, from, to, true);
                obj.Begin();
            });
        }
Ejemplo n.º 20
0
        private void CreateBlinkAnimation(StrokeCollection strokes, AOrientation oritation)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(1, 1);

            AnimationLibrary.Current.GetBlinkAnimationSync(bound, oritation, 2, 0.2, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Scale, center, from, to, true);
                obj.Begin();
            });
        }
Ejemplo n.º 21
0
        private void CreateSwingAnimation(StrokeCollection strokes, Point centerOffset)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(0, 0);

            AnimationLibrary.Current.GetSwingAnimationSync(bound, 1, 30, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Rotate, centerOffset, from, to, true);
                obj.Begin();
            });
        }
Ejemplo n.º 22
0
        private void button16_Click(object sender, EventArgs e)
        {
            ColorDialog MyDialog = new ColorDialog();

            MyDialog.AllowFullOpen = true;
            MyDialog.ShowHelp      = true;
            MyDialog.Color         = Color.Black;
            if (MyDialog.ShowDialog() == DialogResult.OK)
            {
                Color temp = MyDialog.Color;
                AnimationEngine.SetAnimationColor(2, temp);
            }
        }
Ejemplo n.º 23
0
 public override void OnPresentation(bool needStarted)
 {
     base.OnPresentation(needStarted);
     AnimationEngine.Resume();
     if (this.wall != null)
     {
         wall.kMenu.Visibility = System.Windows.Visibility.Visible;
     }
     if (needStarted)
     {
         this.wall.OpenNewDrawing();
     }
 }
Ejemplo n.º 24
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            ResetAnimationEngine();

            animationEngine = (AnimationEngine)EditorGUILayout.EnumPopup("Animation engine:", animationEngine);

            if (animEngine)
            {
                animEngine.ActionAnimGUI(this, parameters);
            }

            AfterRunningOption();
        }
Ejemplo n.º 25
0
 public override object GetViewer()
 {
     if (this.wall == null)
     {
         wall = new Wall();
         wall.kMenu.FireEvent    += kMenu_FireEvent;
         wall.CloseEvent         += wall_CloseEvent;
         wall.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
         wall.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
     }
     AnimationEngine.Pause();
     return(wall);
 }
Ejemplo n.º 26
0
 public MoveAction(GameObject move, GameObject to, AnimationEngine.Type animType)
     : this(move, to)
 {
     this.animType = animType;
     agent         = move.GetComponent <NavMeshAgent> ();
     if ((animEngine = move.GetComponent <AnimationEngine> ()) != null)
     {
         animate = true;
     }
     else
     {
         animate = false;
     }
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Loads all content for the game, and starts the systems.
 /// </summary>
 /// <param name="sender">Irrelevant.</param>
 /// <param name="e">Irrelevant.</param>
 private void Window_Load(object sender, EventArgs e)
 {
     SysConsole.Output(OutputType.INIT, "GameClient starting load sequence...");
     GL.Viewport(0, 0, Window.Width, Window.Height);
     GL.Enable(EnableCap.Texture2D);
     GL.Enable(EnableCap.Blend);
     GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
     GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
     GL.Disable(EnableCap.CullFace);
     GraphicsUtil.CheckError("GEB - Initial");
     SysConsole.Output(OutputType.INIT, "GameClient loading file helpers...");
     Files = new FileHandler();
     Files.Init();
     SysConsole.Output(OutputType.INIT, "GameClient loading shader helpers...");
     Shaders = new ShaderEngine();
     Shaders.InitShaderSystem();
     SysConsole.Output(OutputType.INIT, "GameClient loading texture helpers...");
     Textures = new TextureEngine();
     Textures.InitTextureSystem(Files);
     GraphicsUtil.CheckError("GEB - Textures");
     SysConsole.Output(OutputType.INIT, "GameClient loading font helpers...");
     GLFonts = new GLFontEngine(Textures, Shaders);
     GLFonts.Init(Files);
     FontSets = new FontSetEngine(GLFonts)
     {
         FixTo = Shaders.ColorMult2DShader
     };
     // TODO: FGE/Core->Languages engine!
     FontSets.Init((subdata) => null, () => Ortho, () => GlobalTickTime);
     GraphicsUtil.CheckError("GEB - Fonts");
     SysConsole.Output(OutputType.INIT, "GameClient loading 2D/UI render helper...");
     MainUI = new ViewUI2D(this);
     SysConsole.Output(OutputType.INIT, "GameEngine loading model engine...");
     Animations = new AnimationEngine();
     Models     = new ModelEngine();
     Models.Init(Animations, this);
     SysConsole.Output(OutputType.INIT, "GameEngine loading render helper...");
     Rendering3D = new Renderer(Textures, Shaders, Models);
     Rendering3D.Init();
     Rendering2D = new Renderer2D(Textures, Shaders);
     Rendering2D.Init();
     SysConsole.Output(OutputType.INIT, "GameClient calling engine load...");
     CurrentEngine.Load();
     SysConsole.Output(OutputType.INIT, "GameClient calling external load event...");
     OnWindowLoad?.Invoke();
     SysConsole.Output(OutputType.INIT, "GameClient is ready and loaded! Starting main game loop...");
     GraphicsUtil.CheckError("GEB - Loaded");
     Loaded = true;
 }
Ejemplo n.º 28
0
        AnimationObj CreateAnimationRomdom3(StrokeCollection strokes)
        {
            double x = 10;
            double y = 255;

            AnimationObj obj = AnimationEngine.AddPropertyAnimation(strokes, 5, 255, 0, (change) =>
            {
                byte r = (byte)change;
                foreach (Stroke stroke in strokes)
                {
                    stroke.DrawingAttributes.Color = Color.FromArgb(r, 255, 0, 0);
                }
            });

            return(obj);
        }
Ejemplo n.º 29
0
        public Actor(Game XnaGame, string ActorName, SpriteBatch LocalBatch)
            : base(XnaGame)
        {
            Name = ActorName;

            var _TmpResults = from x in this.Game.Components where x is MouseManager select x;

            _MouseManagerRef = (MouseManager)_TmpResults.First();

            foreach (var x in XnaGame.Components)
            {
                if (x is AnimationManager)
                {
                    _AnimationManagerRef = (AnimationManager)x;
                }
                else if (x is ScreenManager)
                {
                    _ScreenManager = (ScreenManager)x;
                }
                else if (x is Camera)
                {
                    _MainCamera = (Camera)x;
                }
                else if (x is TextureManager)
                {
                    _TextureManager = (TextureManager)x;
                }
                if (_AnimationManagerRef != null && _ScreenManager != null)
                {
                    break;
                }
            }

            if (!_AnimationManagerRef.ActorAnimations.Any(aa => aa.ActorName == Name))
            {
                _AnimationEngine = new AnimationEngine(this.Game, System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "Data\\Actors\\" + Name + "\\data.xml"), Name);
            }
            else
            {
                _AnimationEngine = new AnimationEngine(this.Game, Name);
            }

            _LocalBatch = LocalBatch;
            _MouseManagerRef.OnMouseSelectedAreaChange += new MouseSelectedAreaChanged(_MouseManagerRef_OnMouseSelectedAreaChange);
            _MouseManagerRef.OnMouseRightClick         += new MouseRightClick(_MouseManagerRef_OnMouseRightClick);
            //  _ScreenManager.Screens[_WorldPosition.WorldPointToScreenPoint()].
        }
Ejemplo n.º 30
0
    //public void Init(AnimationAnalyzer analyzer, FootstepPlanningTest planner,
    public void Init(AnimationAnalyzer analyzer, Planner planner, 
	                 AnimationEngine animEngine, CollisionReaction collisionReact, 
	                 NavMeshWayPoints navMeshWaypoints, SteeringManager steering,
	                 NeighbourAgents agents, NeighbourObstacles obstacles,
	                 PlaceFootSteps steps)
    {
        planning = planner;
        if (planning != null && !planning.initialized)
            planning.Init(analyzer,agents,obstacles);

        engine = animEngine;
        if (engine != null && !engine.initialized)
            engine.Init(analyzer,planning,agents,obstacles);

        collision = collisionReact;
        if (collision != null && !collision.initialized)
            collision.Init(analyzer,planner,engine,agents,obstacles);

        waypoints = navMeshWaypoints;
        //if (waypoints != null && !waypoints.initialized)
        //	waypoints.Init(planning,steering,analyzer,agents,obstacles);

        neighborhood = agents;
        if (neighborhood != null && !neighborhood.initialized)
            neighborhood.Init();

        footsteps = steps;
        if (footsteps != null && !footsteps.initiated)
            footsteps.Init(analyzer,planner,engine,neighborhood,obstacles);

        nObstacles = obstacles;
        if (nObstacles != null && !nObstacles.initialized)
            nObstacles.Init();

        timeSinceLastPlan = 0;
        timeSinceLastWaypoints = 0;

        previousGoalPosition = planning.goalStateTransform.position;
        previousCurrentGoalPosition = planning.currentGoal;

        previousActionsSinceLastPlan = -1;

        newWaypoint = false;

        initialized = true;
    }
Ejemplo n.º 31
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            ResetAnimationEngine();

            animationEngine = (AnimationEngine)EditorGUILayout.EnumPopup("Animation engine:", animationEngine);
            if (animationEngine == AnimationEngine.Custom)
            {
                customClassName = EditorGUILayout.TextField("Script name:", customClassName);
            }

            if (animEngine)
            {
                animEngine.ActionAnimGUI(this, parameters);
            }

            AfterRunningOption();
        }
Ejemplo n.º 32
0
    //public void Init (AnimationAnalyzer animAnalyzer, AnimationEngine animEngine, FootstepPlanningTest planner,
    public void Init(AnimationAnalyzer animAnalyzer, AnimationEngine animEngine, Planner planner,
	                  NeighbourAgents agents, NeighbourObstacles obstacles, CollisionReaction colReact)
    {
        analyzer = animAnalyzer;
        if (analyzer != null && !analyzer.initialized)
            analyzer.Init();

        planning = planner;
        if (planning != null && !planning.initialized)
            planning.Init(analyzer, agents, obstacles);

        engine = animEngine;
        if (engine != null && !engine.initialized)
            engine.Init(analyzer,planning,agents,obstacles);

        collision = colReact;
        if (collision != null && !collision.initialized)
            collision.Init(analyzer,planning,engine,agents,obstacles);

        if (debugText != null)
            debugText.gameObject.active = false;

        initialized = true;
    }
Ejemplo n.º 33
0
    //public void Init(AnimationAnalyzer animAnalyzer, FootstepPlanningTest planner, AnimationEngine animEngine,
    public void Init(AnimationAnalyzer animAnalyzer, Planner planner, AnimationEngine animEngine,
	                 NeighbourAgents agents, NeighbourObstacles obstacles)
    {
        analyzer = animAnalyzer;
        if (analyzer != null && !analyzer.initialized)
            analyzer.Init();

        planning = planner;
        if (planning != null && !planning.initialized)
            planning.Init(analyzer, agents, obstacles);

        engine = animEngine;
        if (engine != null && !engine.initialized)
            engine.Init(analyzer,planning,agents,obstacles);

        if (rightFoot.position[1] < leftFoot.position[1])
            auxHeight = rightFoot.position[1];
        else
            auxHeight = leftFoot.position[1];

        counter = 0;

        footSteps = new Object[numberOfFootSteps];

        initiated = true;
    }
Ejemplo n.º 34
0
 public AnimationEngine()
 {
     mInstance = null;
     mInstance = this;
 }
Ejemplo n.º 35
0
        private void OnGUI()
        {
            GUILayout.Label (GetTitle (), EditorStyles.largeLabel);
            if (GetTitle () != "")
            {
                EditorGUILayout.Separator ();
                GUILayout.Space (10f);
            }

            ShowPage ();

            GUILayout.Space (15f);
            GUILayout.BeginHorizontal ();
            if (pageNumber < 1)
            {
                if (pageNumber < 0)
                {
                    pageNumber = 0;
                }
                GUI.enabled = false;
            }
            if (pageNumber < numPages)
            {
                if (GUILayout.Button ("Previous", EditorStyles.miniButtonLeft))
                {
                    pageNumber --;
                }
            }
            else
            {
                if (GUILayout.Button ("Restart", EditorStyles.miniButtonLeft))
                {
                    pageNumber = 1;
                }
            }

            GUI.enabled = true;
            if (pageNumber < numPages - 1)
            {
                if (pageNumber == 1)
                {
                    if (!IsFirstPerson ())
                    {
                        if (baseObject == null || PrefabUtility.GetPrefabType (baseObject) == PrefabType.Prefab || baseObject.GetComponent <AC.Char>() || !baseObject.activeInHierarchy)
                        {
                            GUI.enabled = false;
                        }
                    }
                }

                if (GUILayout.Button ("Next", EditorStyles.miniButtonRight))
                {
                    pageNumber ++;
                    if (pageNumber == 2 && IsFirstPerson ())
                    {
                        pageNumber = 3;
                    }
                    if (pageNumber == 2)
                    {
                        if (baseObject.GetComponentInChildren <Animation>())
                        {
                            animationEngine = AnimationEngine.Legacy;
                        }
                        else if (baseObject.GetComponentInChildren <SkinnedMeshRenderer>() || baseObject.GetComponentInChildren <MeshRenderer>())
                        {
                            animationEngine = AnimationEngine.Mecanim;
                        }
                        else if (baseObject.GetComponentInChildren <SpriteRenderer>())
                        {
                            animationEngine = AnimationEngine.SpritesUnity;
                        }
                        else if (tk2DIntegration.Is2DtkSprite (baseObject))
                        {
                            animationEngine = AnimationEngine.Sprites2DToolkit;
                        }
                        else if (AdvGame.GetReferences () && AdvGame.GetReferences ().settingsManager && AdvGame.GetReferences ().settingsManager.cameraPerspective == CameraPerspective.TwoD)
                        {
                            animationEngine = AnimationEngine.SpritesUnity;
                        }
                        else
                        {
                            animationEngine = AnimationEngine.Mecanim;
                        }
                    }
                }

                GUI.enabled = true;
            }
            else
            {
                if (pageNumber == numPages)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button ("Finish", EditorStyles.miniButtonRight))
                {
                    pageNumber ++;
                    Finish ();
                }
                GUI.enabled = true;
            }
            GUILayout.EndHorizontal ();

            GUILayout.Label ("Page " + (pageNumber + 1) + " of " + (numPages + 1));
        }
Ejemplo n.º 36
0
        private void ShowPage()
        {
            GUI.skin.label.wordWrap = true;

            if (pageNumber == 0)
            {
                if (logo != null)
                {
                    GUILayout.Label (logo);
                }
                GUILayout.Space (5f);
                GUILayout.Label ("This window can assist with the creation of a Player or NPC.");
                GUILayout.Label ("To begin, click 'Next'.");
            }

            else if (pageNumber == 1)
            {
                GUILayout.Label ("Is this a Player or an NPC?");
                charType = (CharType) EditorGUILayout.EnumPopup (charType);

                if (charType == CharType.NPC)
                {
                    EditorGUILayout.BeginHorizontal ();
                    GUILayout.Label ("The character's name:", GUILayout.Width (150f));
                    charName = GUILayout.TextField (charName);
                    EditorGUILayout.EndHorizontal ();
                }
                else
                {
                    if (AdvGame.GetReferences ().settingsManager && AdvGame.GetReferences ().settingsManager.movementMethod == MovementMethod.FirstPerson)
                    {
                        return;
                    }
                }

                GUILayout.Label ("Assign your character's base GameObject (such as a skinned mesh renderer or 'idle' sprite):");
                baseObject = (GameObject) EditorGUILayout.ObjectField (baseObject, typeof (GameObject), true);

                if (baseObject != null && !IsFirstPerson ())
                {
                    if (baseObject.GetComponent <AC.Char>())
                    {
                        EditorGUILayout.HelpBox ("The wizard cannot modify an existing character!", MessageType.Warning);
                    }
                    else if (PrefabUtility.GetPrefabType (baseObject) == PrefabType.Prefab || !baseObject.activeInHierarchy)
                    {
                        EditorGUILayout.HelpBox ("The object must be in the scene and enabled for the wizard to work.", MessageType.Warning);
                    }
                }
            }

            else if (pageNumber == 2)
            {
                GUILayout.Label ("How should your " + charType.ToString () + "' should be animated?");
                animationEngine = (AnimationEngine) EditorGUILayout.EnumPopup (animationEngine);

                if (animationEngine == AnimationEngine.Custom)
                {
                    EditorGUILayout.HelpBox ("This option is intended for characters that make use of a custom/third-party animation system that will require additional coding.", MessageType.Info);
                }
                else if (animationEngine == AnimationEngine.Legacy)
                {
                    EditorGUILayout.HelpBox ("Legacy animation is for 3D characters that do not require complex animation trees or multiple layers. Its easier to use than Mecanim, but not as powerful.", MessageType.Info);
                }
                else if (animationEngine == AnimationEngine.Mecanim)
                {
                    EditorGUILayout.HelpBox ("Mecanim animation is the standard option for 3D characters. You will need to define Mecanim parameters and transitions, but will have full control over how the character is animated.", MessageType.Info);
                }
                else if (animationEngine == AnimationEngine.Sprites2DToolkit)
                {
                    EditorGUILayout.HelpBox ("This option allows you to animate characters using the 3rd-party 2D Toolkit asset.", MessageType.Info);
                    if (!tk2DIntegration.IsDefinePresent ())
                    {
                        EditorGUILayout.HelpBox ("The 'tk2DIsPresent' preprocessor define must be declared in your game's Scripting Define Symbols, found in File -> Build -> Player settings.", MessageType.Warning);
                    }
                }
                else if (animationEngine == AnimationEngine.SpritesUnity)
                {
                    EditorGUILayout.HelpBox ("This option is the standard option for 2D characters. Animation clips are played automatically, without the need to define Mecanim parameters, but you will not be able to make e.g. smooth transitions between the different movement animations.", MessageType.Info);
                }
                else if (animationEngine == AnimationEngine.SpritesUnityComplex)
                {
                    EditorGUILayout.HelpBox ("This option is harder to use than 'Sprites Unity', but gives you more control over how your character animates - allowing you to control animations using Mecanim parameters and transitions.", MessageType.Info);
                }
            }

            else if (pageNumber == 3)
            {
                EditorGUILayout.LabelField ("Chosen animation engine: " + animationEngine.ToString (), EditorStyles.boldLabel);

                if (!IsFirstPerson ())
                {
                    if (animationEngine == AnimationEngine.Custom)
                    {
                        EditorGUILayout.HelpBox ("A subclass of 'AnimEngine' will be used to bridge AC with an external animation engine. The subclass script defined above must exist for the character to animate. Once created, enter its name in the box below:", MessageType.Info);
                        customAnimationClass = EditorGUILayout.TextField ("Subclass script name:", customAnimationClass);
                    }
                    else if (animationEngine == AnimationEngine.Mecanim || animationEngine == AnimationEngine.SpritesUnityComplex || animationEngine == AnimationEngine.SpritesUnity)
                    {
                        if (baseObject.GetComponent <Animator>() == null)
                        {
                            EditorGUILayout.HelpBox ("This chosen method will make use of an Animator Controller asset.\nOnce the wizard has finished, you will need to create such an asset and assign it in your character's 'Animator' component.", MessageType.Info);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox ("This chosen method will make use of an Animator component, and one has already been detected on the base object.\nThis will be assumed to be the correct Animator to make use of.", MessageType.Info);
                        }
                    }

                    if (animationEngine == AnimationEngine.Sprites2DToolkit || animationEngine == AnimationEngine.SpritesUnityComplex || animationEngine == AnimationEngine.SpritesUnity)
                    {
                        if (AdvGame.GetReferences () != null && AdvGame.GetReferences ().settingsManager != null && AdvGame.GetReferences ().settingsManager.cameraPerspective != CameraPerspective.TwoD)
                        {
                            EditorGUILayout.LabelField ("It has been detected that you are attempting\nto create a 2D character in a 3D game.\nIs this correct?", GUILayout.Height (40f));
                            enforce3D = EditorGUILayout.Toggle ("Yes!", enforce3D);
                        }
                    }
                }
                EditorGUILayout.HelpBox ("Click 'Finish' below to create the character and complete the wizard.", MessageType.Info);
            }

            else if (pageNumber == 4)
            {
                GUILayout.Label ("Congratulations, your " + charType.ToString () + " has been created! Check the '" + charType.ToString () + "' Inspector to set up animation and other properties, as well as modify any generated Colliders / Rigidbody components.");
                if (charType == CharType.Player)
                {
                    GUILayout.Space (5f);
                    GUILayout.Label ("To register this is as the main player character, turn it into a prefab and assign it in your Settings Manager, underneath 'Player settings'.");
                }
            }
        }
Ejemplo n.º 37
0
        private void ResetAnimationEngine(AnimationEngine animationEngine)
        {
            string className = "AnimEngine_" + animationEngine.ToString ();

            if (editingAnimEngine == null || editingAnimEngine.ToString () != className)
            {
                editingAnimEngine = (AnimEngine) ScriptableObject.CreateInstance (className);
            }
        }
Ejemplo n.º 38
0
    private void hover_AnimateClicked(object sender, EventArgs e)
    {
        dbg.WriteLine("----- hover_AnimateClicked -----");

        PhysicsIllustrator.SmartTag.SmartTag tag = sender as PhysicsIllustrator.SmartTag.SmartTag;

        // Running or stopping?
        if (inkoverlay.Enabled)
        {
            // Aqui vou mandar o evento para o servidor!
            // Este evento eh para o início da simulação
            Global.clienteEnvia.EnviaEvento(new ArrayList(),"Start");

            // Lock down all editing operations.
            DisableInkOverlay();
            if (bodytag.Visible) bodytag.Hide();

            // Habilita o botão pause.
            hover.Enabled = false;

            tag.Image = Global.LoadImage("Resources.PauseAnimate.ico");
            menuttip.SetToolTip(tag,"Pause");
            tag.Show();

            // Fork the document for animation.
            MagicDocument animedoc = doc.Clone();

            // Transformar o engine de simulação em uma Thread!

            // Run the animation!
            engine = new AnimationEngine();
            engine.Start(animedoc,this);

            engine.setPause(false);

        }
        else // Pausa
        {
            if(engine.getPause()) // Está pausado!
            {
                // Aqui vou mandar o evento para o servidor!
                // Este evento eh para o resume
                Global.clienteEnvia.EnviaEvento(new ArrayList(),"Resume");

                engine.setPause(false);
                tag.Image  =  Global.LoadImage("Resources.PauseAnimate.ico");
                menuttip.SetToolTip(tag,"Pause");
                tag.Visible = true;
                tag.Show();

                 hover.getPauseTag().Visible = false;

            }
            else // Está rodando
            {

                // Aqui vou mandar o evento para o servidor!
                // Este evento eh para o pause
                Global.clienteEnvia.EnviaEvento(new ArrayList(),"Pause");

                engine.setPause(true);
                // Devo pausar e mudar o ícone do botão

                tag.Image  =  Global.LoadImage("Resources.ResumeAnimate.ico");
                menuttip.SetToolTip(tag,"Resume");

                hover.getPauseTag().Image  =  Global.LoadImage("Resources.StopAnimation.ico");
                menuttip.SetToolTip(hover.getPauseTag(),"Stop");
                hover.getPauseTag().Visible = true;
                hover.getPauseTag().Show();

            }
        }
    }
Ejemplo n.º 39
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            ResetAnimationEngine ();

            animationEngine = (AnimationEngine) EditorGUILayout.EnumPopup ("Animation engine:", animationEngine);

            if (animEngine)
            {
                animEngine.ActionAnimGUI (this, parameters);
            }

            AfterRunningOption ();
        }
Ejemplo n.º 40
0
    //public void Init(AnimationAnalyzer animAnalyzer, FootstepPlanningTest planner, AnimationEngine animEngine, NeighbourAgents agents, NeighbourObstacles obstacles)
    public void Init(AnimationAnalyzer animAnalyzer, Planner planner, AnimationEngine animEngine,NeighbourAgents agents, NeighbourObstacles obstacles)
    {
        analyzer = animAnalyzer;
        if (analyzer != null && !analyzer.initialized)
            analyzer.Init();

        planning = planner;
        if (planning != null && !planning.initialized)
            planning.Init(analyzer, agents, obstacles);

        engine = animEngine;
        if (engine != null && !engine.initialized)
            engine.Init(analyzer,planning, agents, obstacles);

        reacting = false;

        initialized = true;
    }
Ejemplo n.º 41
0
    public void hover_AnimateClickedStartImpl(object sender)
    {
        // Aqui vou começar a simulação remotamente

        // Lock down all editing operations.
        DisableInkOverlay();
        if (bodytag.Visible)
            bodytag.Hide();

        // Habilita o botão pause.
        hover.Enabled = false;

        hover.getAnimateTag().Image = Global.LoadImage("Resources.PauseAnimate.ico");
        menuttip.SetToolTip(hover.getAnimateTag(),"Pause");
        hover.getAnimateTag().Show();

        // Fork the document for animation.
        MagicDocument animedoc = doc.Clone();

        // Run the animation!
        engine = new AnimationEngine();
        engine.Start(animedoc,this);

        engine.setPause(false);
    }
Ejemplo n.º 42
0
 public void SetAnimEngine(AnimationEngine _animationEngine, string customClassName = "")
 {
     animationEngine = _animationEngine;
     if (animationEngine == AnimationEngine.Custom)
     {
         customAnimationClass = customClassName;
     }
     ResetAnimationEngine ();
 }