Ejemplo n.º 1
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("Body");

            child.transform.localScale = ModelScale;

            GameObject child2 = Prefab.transform.Find("Chickadoo/mesh_body1").gameObject;

            // Load Components
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            EggActivator       egg   = Prefab.GetComponent <EggActivator>();
            TransformAfterTime trans = Prefab.GetComponent <TransformAfterTime>();

            MeshFilter          model   = child.GetComponent <MeshFilter>();
            SkinnedMeshRenderer mRender = child2.GetComponent <SkinnedMeshRenderer>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            trans.delayGameHours = DelayGameHours;
            trans.options        = Options;

            egg.eggPeriod = EggPeriod;

            model.sharedMesh       = Mesh;
            mRender.sharedMaterial = ModelMat;

            foreach (MeshRenderer render in Prefab.transform.Find("Chickadoo/root").GetComponentsInChildren <MeshRenderer>())
            {
                if (render.sharedMaterial.name.Equals("Chickadoo"))
                {
                    render.sharedMaterial = ModelMat;
                }
            }
        }
Ejemplo n.º 2
0
        public override void Draw()
        {
            if (actorActions.Actor == null)
            {
                return;
            }

            transformAfterTime = actorActions.Actor.TraitOrDefault <TransformAfterTime>();

            //hide
            WidgetUtils.DrawRGBA(background2, new float2(RenderBounds.Left + 0, RenderBounds.Top + 298));
            WidgetUtils.DrawRGBA(background3, new float2(RenderBounds.Left + 90, RenderBounds.Top + 298));

            // draw empty
            WidgetUtils.DrawRGBA(emptyMoons, new float2(RenderBounds.Left + 4, RenderBounds.Top + 266));
            WidgetUtils.DrawRGBA(emptyMen, new float2(RenderBounds.Left + 124, RenderBounds.Top + 298));

            var progress = 8 * transformAfterTime.Ticker / transformAfterTime.Time;

            if (progress > 1)
            {
                WidgetUtils.DrawRGBA(moonPhase2, new float2(RenderBounds.Left + 38, RenderBounds.Top + 266 + 8));
            }
            if (progress > 2)
            {
                WidgetUtils.DrawRGBA(moonPhase3, new float2(RenderBounds.Left + 62, RenderBounds.Top + 266 + 8));
            }
            if (progress > 3)
            {
                WidgetUtils.DrawRGBA(moonPhase4, new float2(RenderBounds.Left + 88, RenderBounds.Top + 266 + 8));
            }
            if (progress > 5)
            {
                WidgetUtils.DrawRGBA(moonPhase5, new float2(RenderBounds.Left + 114, RenderBounds.Top + 266 + 8));
            }
            if (progress > 6)
            {
                WidgetUtils.DrawRGBA(moonPhase6, new float2(RenderBounds.Left + 142, RenderBounds.Top + 266 + 8));
            }
            if (progress > 7)
            {
                WidgetUtils.DrawRGBA(readyMen, new float2(RenderBounds.Left + 128, RenderBounds.Top + 298));
            }
        }