Exemple #1
0
        void Start()
        {
            List <string> animationFiles = new List <string>();

            animationFiles.Add("take-1_DEFAULT_C26");
            animationFiles.Add("take-2_DEFAULT_C26");
            animationFiles.Add("take-3_DEFAULT_C26");
            animationFiles.Add("take-4_DEFAULT_C26");
            animationFiles.Add("take-5_DEFAULT_C26");
            animationFiles.Add("take-6_DEFAULT_C26");

            // We assume that the Character has the correct structure
            this._model = this.gameObject.transform;
            this._mc    = new MovementComponent(this._model);
            this._fc    = new FollowerComponent(this._model);
            this._ac    = new AnimationComponent(this._model);
            this._rc    = new RuntimeComponent(this._fc, animationFiles, RecalculateAnimationsFlag);

            if (this._model == null)
            {
                throw new System.Exception("SalamanderController was unable to find the model.");
            }

            // Initialize Trajectory's past to the initial position
            for (int i = 0; i < FeaturePastPoints; i++)
            {
                this._trajectory.points.Add(new Trajectory.Point(new Vector2(0f, 0f), Quaternion.identity));
            }
        }
        public RuntimeComponent(FollowerComponent fc)
        {
            // TODO: This should happen offline. Instead we only need to open its result
            this._anim.Add(Packer.Pack("walk", "MoCapData", "walk_DEFAULT_FIX"));
            this._anim.Add(Packer.Pack("jog", "MoCapData", "jog3_DEFAULT_FIX"));
            this._anim.Add(Packer.Pack("acceleration", "MoCapData", "acceleration_DEFAULT_FIX"));
            this._anim.Add(Packer.Pack("run", "MoCapData", "Copy of run1_DEFAULT_FIX"));
            this._anim.Add(Packer.Pack("walk_continuous", "MoCapData", "walk_continuous2_DEFAULT_FIX"));
            this._anim.Add(Packer.Pack("circle_left", "MoCapData", "circle_left_DEFAULT_FIX"));
            this._anim.Add(Packer.Pack("circle_right", "MoCapData", "circle_right_DEFAULT_FIX"));

            // TODO: This exists for dubugging. Maybe it needs to be removed.
            this._fc = fc;
        }
        void Start()
        {
            // We assume that the Character has the correct structure
            Transform character = this.gameObject.transform;

            this._model = character.GetChild(0);
            this._mc    = new MovementComponent(character);
            this._fc    = new FollowerComponent(this._model);
            this._rc    = new RuntimeComponent(this._fc);
            this._ac    = new AnimationComponent(this._model.GetChild(0));

            // Initialize Trajectory's past to the initial position
            for (int i = 0; i < FeaturePastPoints; i++)
            {
                this._trajectory.points.Add(new Trajectory.Point(new Vector2(0f, 0f), Quaternion.identity));
            }
        }
Exemple #4
0
        public RuntimeComponent(FollowerComponent fc, List <string> files, bool recalculateFlag = true)
        {
            Debug.Log("MoMa: " + (recalculateFlag ? " Recalculate animations using Packer" : " Using pre-calculated animations"));

            foreach (string filename in files)
            {
                Animation loadedAnimation =
                    // Recalculate animations using Packer and .csv files in Resource
                    Packer.Pack(filename, filename);
                // Don't recalculate animations. Load the existing assets
                //LoadPackedAnimationFile(filename);

                this._anim.Add(loadedAnimation);

                Debug.Log("Loaded MoMa file \"" + filename + "\" with " + loadedAnimation.frameList.Count + " frames");
            }

            // This exists for dubugging. Maybe it needs to be removed.
            #if UNITY_EDITOR
            this._fc = fc;
            #endif
        }