Exemplo n.º 1
0
        public override void Initialize()
        {
            GameObject go = new GameObject((uint)SingleRandom.Instance.rnd.Next() + 105012, "MyTrigger");

            go.MyTransform = new Transform(go, Vector3.Zero, Vector3.Forward, Vector3.Zero, this.MyObject.MyTransform.Scale + 2.0f);
            go.MyCollider  = new BoxCollider(go, true);
            TrashTrigger tt = new TrashTrigger(go);

            tt.Init(null, this.TrashCount);
            go.Components.Add(tt);
            this.MyObject.AddChild(go);
            tt.Initialize();

            base.Initialize();
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            GameObject go = new GameObject((uint)SingleRandom.Instance.rnd.Next() + 105012, "MyTrigger");

            go.MyTransform = new Transform(go, this.MyObject.MyTransform.Position, Vector3.Forward, Vector3.Zero, this.MyObject.MyTransform.Scale + 3.0f);
            tt             = new TrashTrigger(go);
            go.MyCollider  = new BoxCollider(go, true);
            tt.Init(this.MyObject, this.TrashCount);
            go.Components.Add(tt);
            this.MyObject.AddChild(go);
            tt.Initialize();
            //ResourceManager.Instance.CurrentScene.AddObjectRuntime(go);

            bool second = false;

            foreach (ObjectComponent comp in MyObject.Components)
            {
                if (comp.GetType() == typeof(CustomModel))
                {
                    if (!second)
                    {
                        modelGood = (CustomModel)comp;
                        second    = true;
                    }
                    else
                    {
                        modelBad = (CustomModel)comp;
                        break;
                    }
                }
            }

            if (modelBad != null)
            {
                modelBad.Visible = false;
            }

            base.Initialize();
        }