private Camera(Camera3D camera, GameObject player)
        {
            this.cam = camera;
            this.player = player;

            HeadsetSetup();
        }
		public static void AddLightSource(GameObject obj, float intensity, Color color)
		{
			IMaterialPointLight l = Lights.CreatePointLight(obj.PhysicsEntity.Position, intensity, color);
			l.SourceRadius = 15;
			l.PriorityMultiplier = 10;
			if (LightSources.ContainsKey(obj)) LightSources[obj] = l;
			else LightSources.Add(obj, l);
		}
Beispiel #3
0
        public RenderObject(GameObject obj) {
            GameObject = obj;
            IEnumerable<Item> items = obj.GetItems();
            
            foreach(Item item in items)
                sprites.Add(new Sprite(item));
            MiniMapLocation = WinAdapter.CoordPoint2Vector(obj.Position / 10000f);

            primitives = obj.GetPrimitives();
        }
Beispiel #4
0
        void TaskLeaveDeathZone(GameObject obj) {
            // set target location as end of vector, normal to strait vector from center of danger obj
            CoordPoint toTarget = targetObject.Position - owner.Position;
            CoordPoint leaveVector = (owner.Position - obj.Position) * 2;

            if(Math.Abs(leaveVector.AngleTo(toTarget)) < Math.PI / 8)
                targetLocation = targetObject.Position;
            else {

                CoordPoint v1 = new CoordPoint(-leaveVector.Y, leaveVector.X);
                CoordPoint v2 = new CoordPoint(leaveVector.Y, -leaveVector.X);

                float a1 = Math.Abs(v1.AngleTo(toTarget));
                float a2 = Math.Abs(v2.AngleTo(toTarget));

                CoordPoint normalVector = a1 < a2 ? v1 : v2;


                targetLocation = leaveVector + normalVector + owner.Position;
            }
        }
        public HandController(Camera camera, Scene scene, ContentState state)
        {
            this.camera = camera;

            hand = ObjectComposer.Compose(scene, state)
                .AppendName("hand")
                .AppendMesh("hand")
                .AppendMaterialTextures("hand_map", "hand_map")
                .AppendWorld(Vector3.Zero,Vector3.Zero, Vector3.One * 0.02f)
                .AppendDummyCollider()
                .FinishAndAddToScene();

            int animationIndex = hand.Model.GetAnimationController().AnimationIndex("Take 001");
            hand.Model.GetAnimationController().PlayLoopingAnimation(animationIndex);

            bonesController = new HandAnimator(hand.Model.ModelData);
            hand.BoneModifier = bonesController;

            curseParticles = new ParticleSystem(state.Application.UpdateManager);
            TestScene._instance.AddDrawable(new BillboardParticles3D(curseParticles));
            curseParticles.ParticleSystemData = TestScene._instance.state.Load<ParticleSystemData>("Particles/Spark");
            curseParticlesTriger = curseParticles.GetTriggerByName("burst");

        }
Beispiel #6
0
        //public CoordPoint Reactive { get { return -(direction * acceleration) * 50; } }

        //public CoordPoint Velosity { get { return velosity; } }

        public Ship( GameObject target, StarSystem system) : base(system) {

            Hull = new ShipHull() { Owner = this };
            Inventory = new Inventory(Hull);
            var e1 = new DefaultEngine();
                var e2 = new DefaultEngine();
                var w1 = new DefaultWeapon();
            Inventory.Add(e1);
            Inventory.Add(e2);
            Inventory.Add(w1);
            //Hull.Attach(new AttachedItem(new CoordPoint(20, 20), new CoordPoint(10,10)), Hull.Slots[0]);
            //Hull.Attach(new AttachedItem(new CoordPoint(20, 20), new CoordPoint(10, 10)), Hull.Slots[1]);

            Inventory.Attach(Hull.Slots[0], e1);
            Inventory.Attach(Hull.Slots[1], e2);
            Inventory.Attach(Hull.Slots[2], w1);

            Mass = 1;
            Color = RndService.GetColor();
            Reborn();
            if(target!=null)
               controller = new AIController(this, target, TaskType.Peersuit);

        }
		public static void RemoveLightSource(GameObject obj)
		{
			Lights.RemoveLight(LightSources[obj]);
			LightSources.Remove(obj);
		}
Beispiel #8
0
 public AIController(Ship ship, GameObject target, TaskType taskType) {
     owner = ship;
     targetObject = target;
     task = taskType;
 }
Beispiel #9
0
 public static float CalcGravitationForce(GameObject obj1, GameObject obj2) {
     return Gravitation * obj1.Mass * obj2.Mass / CoordPoint.Distance(obj1.Position, obj2.Position);
 }
 public virtual void Remove(GameObject gameObj)
 {
     beingRemoved.Add(gameObj);
 }
		public void Add(GameObject gameObj)
		{
			drawToScreen.Add(gameObj);
		}
Beispiel #12
0
 static RenderObject CreateRenderObject(GameObject obj) {
     RenderObject renderObject = new RenderObject(obj);
     return renderObject;
 }
 public static void MakeCamera(Camera3D camera, GameObject followedObject)
 {
     Camera c = new Camera(camera, followedObject);
     instance = c;
 }
Beispiel #14
0
 public static CoordPoint GetSummaryAttractingForce(List<Body> objects, GameObject subject) {
     var vector = new CoordPoint();
     foreach(var obj in objects)
         vector += GravitationForceVector(subject, obj);
     return vector;
 }
Beispiel #15
0
 public static CoordPoint GravitationForceVector(GameObject obj1, GameObject obj2) {
     float force = CalcGravitationForce(obj1, obj2);
     var direction = (obj2.Position - obj1.Position).UnaryVector;
     return direction * force;
 }
        private void HandleHit(GameObject bullet, GameObject target)
        {
            if (target.Name == "player" || target.Name == "hand") return;

            if (target.Name == "Monster1a" || target.Name == "Monster1b")
                target.Squash(100);
            
        }
 public override void Remove(GameObject gameObj)
 {
     allObjects.Remove(gameObj);
     base.Remove(gameObj);
 }
 public TrajectoryCalculator(GameObject obj) {
     this.virtObj = new VirtualObject(obj.CurrentSystem, obj.Mass, obj.Position, obj.Velosity);
     realObj = obj;
 }