Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        protected override void Init()
        {
            base.Init();

            _meshComponent = Components.Single(c => c.Id == MeshComponentId) as MeshComponent;
            _meshComponent.MeshResourceName = "star";
            _meshComponent.Material.TextureName = "star";

            this.Scale = new Vector3(0.05f, 0.05f, 0.05f);

            var body = Components.Single(c => c is RigidBodyFarseerComponent) as RigidBodyFarseerComponent;
            body.IsSensor = true;

            this.OnObjectCollision += Star_OnObjectCollision;

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