public override bool InternalLoad()
        {
            _rigidBody = GameObject.Components.FirstOrDefault(c => c is RigidBodyFarseerComponent) as RigidBodyFarseerComponent;

            if (_rigidBody != null && _rigidBody.IsKinematic)
            {
                return base.InternalLoad();
            }

            return false;
        }
Beispiel #2
0
        protected override void Init()
        {
            /* todo: re-use rendercomponent, like cube !! */
            _meshComponent = Components.Single(c => c.Id == MeshComponentId) as MeshComponent;
            _meshRenderComponent = Components.Single(c => c.Id == MeshRenderComponentId) as MeshRenderComponent;
            _rigidBodyComponent = Components.Single(c => c.Id == RigidBodyFarseerComponentId) as RigidBodyFarseerComponent;
            _sphereColliderComponent = Components.Single(c => c.Id == SphereColliderFarseerComponentId) as SphereColliderFarseerComponent;

            Rings = 16;
            Segments = 16;
        }
Beispiel #3
0
        protected override void Init()
        {
            base.Init();

            _rigidBodyComponent = this.Components.Single(c => c is RigidBodyFarseerComponent) as RigidBodyFarseerComponent;
            _meshComponent = this.Components.Single(c => c is MeshComponent) as MeshComponent;

            _rigidBodyComponent.IsGravitySource = true;
            _rigidBodyComponent.GravityRange = 1.0f;
            _rigidBodyComponent.IsStatic = true;
            _rigidBodyComponent.Mass = 1000;

            _selectionCube = this.Children.Single(c => c.Id == SelectionCubeId) as Cube;
            _selectionCube.OnMouseDown += SphereMagnet_OnMouseDown;
            _selectionCube.Visible = false;

            _haloPlane = this.Children.Single(c => c.Id == HaloPlaneId) as MagnetHalo;
            _haloPlane.Material.TextureName = "MagnetHalo";

            this.OnScale += new EventHandler<Engine.Events.ScaleEvent>(SphereMagnet_OnScale);
        }
Beispiel #4
0
        protected override void Init()
        {
            _meshComponent = Components.Single(c => c.Id == MeshComponentId) as MeshComponent;
            _meshRenderComponent = Components.Single(c => c.Id == MeshRenderComponentId) as MeshRenderComponent;
            _rigidBodyComponent = Components.Single(c => c.Id == RigidBodyFarseerComponentId) as RigidBodyFarseerComponent;
            _circleColliderComponent = Components.Single(c => c.Id == CircleColliderFarseerComponentId) as CircleColliderFarseerComponent;
            _fixedRevoluteJoinComponent = Components.Single(c => c.Id == FixedRevoluteJointComponentId) as FixedRevoluteJointComponent;

            _meshComponent.MeshResourceName = "cylinder";
            _meshComponent.Material.TextureName = "fabric";
        }
Beispiel #5
0
        protected override void Init()
        {
            _meshComponent = Components.Single(c => c.Id == MeshComponentId) as MeshComponent;
            _meshRenderComponent = Components.Single(c => c.Id == MeshRenderComponentId) as MeshRenderComponent;
            _rigidBodyComponent = Components.Single(c => c.Id == RigidBodyFarseerComponentId) as RigidBodyFarseerComponent;
            _boxColliderComponent = Components.Single(c => c.Id == BoxColliderFarseerComponentId) as BoxColliderFarseerComponent;

            _meshComponent.MeshResourceName = "cube";
        }
        protected override void Init()
        {
            base.Init();

            _aimSphere = Children.First(c => c.Id == DisplaySphereId) as Sphere;
            _aimSphere.Name = "aimSphere";
            _aimSphere.Scale = new Vector3(5);
            _aimSphere.Material.Ambient = new Vector4(1, 0, 0, 0.5f);
            _aimSphere.Material.TextureName = "ball";
            _aimSphere.OnMouseDown += new EventHandler<Engine.Events.MouseButtonDownEvent>(_aimSphere_OnMouseDown);
            _aimSphere.OnMouseUp += new EventHandler<Engine.Events.MouseButtonUpEvent>(_aimSphere_OnMouseUp);
            _aimSphere.Visible = false;

            _arrow2d = Children.First(c => c.Id == Arrow2dId) as Arrow2d;

            _lightObject = Children.First(c => c.Id == LightObjectId) as LightObject;
            _lightObject.Visible = false;
            _lightObject.Enabled = false;

            _meshComponent = this.Components.First(c => c is MeshComponent) as MeshComponent;
            _rigidBodyComponent = this.Components.First(c => c is RigidBodyFarseerComponent) as RigidBodyFarseerComponent;

            var circleCollider = this.Components.First(c => c is CircleColliderFarseerComponent) as CircleColliderFarseerComponent;
            //circleCollider.Radius = 0.5f;

            Material.TextureName = "greenball";

            _leftEye = this.Children.First(c => c.Id == LeftEyeId) as Plane;
            _rightEye = this.Children.First(c => c.Id == RightEyeId) as Plane;

            _leftEye.Material.TextureName = "eye";
            _rightEye.Material.TextureName = "eye";

            _leftEye.DistanceSorting = true;
            _rightEye.DistanceSorting = true;

            _leftEye.Position = -_eyePosition;
            _rightEye.Position = _eyePosition;

            _rightEye.Scale = new Vector3(0.1f, 0.1f, 0.1f);
            _leftEye.Scale = new Vector3(0.1f, 0.1f, 0.1f);
        }
Beispiel #7
0
        protected override void Init()
        {
            base.Init();

            var circleCollider = this.Components.First(c => c is CircleColliderFarseerComponent) as CircleColliderFarseerComponent;
            //circleCollider.Radius = 0.5f;

            _rigidBody = this.Components.First(c => c is RigidBodyFarseerComponent) as RigidBodyFarseerComponent;

            Material.TextureName = "enemy";

            _leftEye = this.Children.First(c => c.Id == LeftEyeId) as Plane;
            _rightEye = this.Children.First(c => c.Id == RightEyeId) as Plane;

            _leftEye.Material.TextureName = "eye";
            _rightEye.Material.TextureName = "eye";

            _leftEye.DistanceSorting = true;
            _rightEye.DistanceSorting = true;

            _leftEye.Position = -_eyePosition;
            _rightEye.Position = _eyePosition;

            _rightEye.Scale = new Vector3(0.1f, 0.1f, 0.1f);
            _leftEye.Scale = new Vector3(0.1f, 0.1f, 0.1f);

            this.OnObjectCollision +=  Enemy_OnObjectCollision;

            _flare = this.Children.Single(c => c.Id == StarFlareId) as StarFlare;

            _textObject = new TextObject();
            _textObject.CreationMode = CreationModeEnum.Runtime;

            _textObject.Position = new Vector3(0.25f, 2, 0);
            _textObject.SetText("Test");
            _textObject.Material.Ambient = new Vector4(1);
            _textObject.Material.Diffuse = new Vector4(1);

            _textObject.Scale = new Vector3(5);
        }