/// <summary>
        /// Converts the record/s into a Unity GameObject structure with meshes, materials etc and imports into the scene.
        /// Adds a Component to the DOF GameObject if one is assigned in the Settings.
        /// </summary>
        public override void ImportIntoScene()
        {
            base.ImportIntoScene();
            var switchComp = UnityGameObject.AddComponent <SwitchNode>();

            switchComp.OnSwitchNode(this);
        }
示例#2
0
        public void SetupAnimationClips()
        {
            if (!mAnimationsSetup)
            {
                Animation animationComponent = UnityGameObject.GetComponentInChildren(typeof(Animation)) as Animation;

                if (animationComponent == null)
                {
                    throw new Exception("Unable to find the animation component under " + UnityGameObject.name);
                }

                if (mImpatientSitIdle == null ||
                    mSittingIdle == null ||
                    mMediumHurried == null ||
                    mCatWalk == null)
                {
                    throw new Exception
                          (
                              "Not all the animations are set up on FashionModel. Still need; " +
                              (mImpatientSitIdle == null ? "mImpatientSitIdle " : "") +
                              (mSittingIdle == null ? "mSittingIdle " : "") +
                              (mMediumHurried == null ? "mMediumHurried " : "") +
                              (mCatWalk == null ? "mCatWalk " : "")
                          );
                }

                animationComponent.AddClip(mImpatientSitIdle, mImpatientSitIdle.name);
                animationComponent.AddClip(mSittingIdle, mSittingIdle.name);
                animationComponent.AddClip(mMediumHurried, mMediumHurried.name);
                animationComponent.AddClip(mCatWalk, mCatWalk.name);

                mAnimationsSetup = true;
            }
        }
示例#3
0
        /// <summary>
        /// Converts the record/s into a Unity GameObject structure with meshes, materials etc and imports into the scene.
        /// </summary>
        public override void ImportIntoScene()
        {
            base.ImportIntoScene();
            var dofComp = UnityGameObject.AddComponent <DegreeOfFreedom>();

            dofComp.OnDOFNode(this);
        }
        /// <summary>
        /// Converts the record/s into a Unity GameObject structure with meshes, materials etc and imports into the scene.
        /// Adds a Component to the LOD GameObject if one is assigned in the Settings.
        /// </summary>
        public override void ImportIntoScene()
        {
            base.ImportIntoScene();
            var lodComp = UnityGameObject.AddComponent <LevelOfDetail>();

            lodComp.OnLODNode(this);
        }
示例#5
0
    public Character(TestableGameObject obj,
                     IRigidBody body,
                     IBoxCollider collider
                     /*[Resource("Characters/char")] TestableGameObject character*/
                     ) : base(obj)
    {
        this.obj         = obj;
        this.collider    = collider;
        this.body        = body;
        body.isKinematic = true;
        TestableGameObject character = new UnityGameObject(GameManager.instance.Character);

        character.transform.Parent        = obj.transform;
        character.transform.LocalPosition = Vector3.zero;
        obj.transform.Position            = GameManager.instance.LevelController.StartTransform.position;
        GameManager.instance.CanRun       = true; //старт
    }
示例#6
0
        /// <summary>
        /// Starts a walk down the runway
        /// </summary>
        public void SetActive(FashionModelNeeds needs, FashionLevel level)
        {
            if (needs == null)
            {
                throw new ArgumentNullException("needs");
            }
            mNeeds = needs;

            if (level == null)
            {
                throw new ArgumentNullException("level");
            }
            mLevel = level;

            mNametag.MainGui.Showing = true;

            mDesiredClothing.Clear();
            if (mDesiredClothingFrame != null)
            {
                mDesiredClothingFrame.ClearChildWidgets();
            }
            mDesiredStations.Clear();

            mStateMachine = new FashionModelStateMachine(this, mLevel);

            UnityGameObject.transform.position = mLevel.Start.First;

            mActiveWalkCycle      = mCatWalk;
            mActiveWalkCycleSpeed = mCatWalkSpeed;

            mCompletionBonusTime = 5.0f;
            mReady = false;

            mHandleBonusTask = mScheduler.StartCoroutine(HandleBonus());

            IGuiManager manager = GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>();

            mDesiredClothingFrame = new GuiFrame("MainFrame", new MainFrameSizePosition());

            IGuiStyle windowStyle = new GuiStyle(manager.GetDefaultStyle(typeof(Window)), "ModelNeedsWindow");

            windowStyle.Normal.Background = null;
            windowStyle.Hover.Background  = null;

            // TODO: Hard coded values
            float windowHeight = 192.0f;

            mDesiredClothingWindow = new Window
                                     (
                "ModelClothingPanel",
                new FixedSize(128.0f, windowHeight),
                manager,
                mDesiredClothingFrame,
                windowStyle
                                     );

            // TODO: Hard coded values
            mFollowWorldSpaceObject = new FollowWorldSpaceObject
                                      (
                GameFacade.Instance.RetrieveMediator <FashionCameraMediator>().Camera,
                this.DisplayObject.transform,
                GuiAnchor.CenterLeft,
                new Vector2(0.0f, windowHeight * 0.4f),
                new Vector3(0.125f, APPROX_AVATAR_HEIGHT * 1.3f, 0.25f)
                                      );

            manager.SetTopLevelPosition
            (
                mDesiredClothingWindow,
                mFollowWorldSpaceObject
            );

            ClothingMediator clothingMediator = GameFacade.Instance.RetrieveMediator <ClothingMediator>();

            // Setup Clothes GUI
            foreach (ItemId clothing in mNeeds.Clothing)
            {
                Image desiredClothingImage = new Image("DesiredClothingLabel", clothingMediator.GetThumbStyle(clothing), clothingMediator.GetThumbnail(clothing));
                mDesiredClothing.Add(clothing, desiredClothingImage);
                mDesiredClothingFrame.AddChildWidget(desiredClothingImage, new HorizontalAutoLayout());
            }

            // Setup Station GUI
            foreach (ModelStation station in mNeeds.Stations)
            {
                Image desiredStationImage = new Image("DesiredStationImage", station.Image);

                mDesiredStations.Add(station, desiredStationImage);
                mDesiredClothingFrame.AddChildWidget(desiredStationImage, new HorizontalAutoLayout());

                mCompletionBonusTime += station.WaitTime + mWalkToStationTimeBonus;
            }

            this.DisplayObject.SetActiveRecursively(true);

            Shader fashionModelShader = Shader.Find("Avatar/Fashion Model");

            if (fashionModelShader == null)
            {
                throw new Exception("Cannot find 'Avatar/Fashion Model' shader");
            }

            mModelMaterials.Clear();
            foreach (Component component in UnityGameObject.GetComponentsInChildren(typeof(Renderer)))
            {
                Renderer renderer = (Renderer)component;
                foreach (Material mat in renderer.materials)
                {
                    mat.shader = fashionModelShader;
                    mModelMaterials.Add(mat);
                }
            }

            mNeeds.AddOnCompleteAction(ModelComplete);
        }
示例#7
0
 /// <summary>
 /// Creates a Unity implementation for  <see cref="IComponent"/>.
 /// </summary>
 /// <param name="unityComponent">Unity component instance to wrap.</param>
 public UnityComponent(Component unityComponent)
 {
     this.unityComponent = unityComponent;
     GameObject = new UnityGameObject(unityComponent.gameObject);
     Entity = new UnityMortarEntity();
 }