Esempio n. 1
0
        private void Initialize()
        {
            //float mass;
            //Vector3 com;
            //Matrix it, itCom;
            //Skin.GetMassProperties(new PrimitiveProperties( PrimitiveProperties.MassDistributionEnum.Shell, PrimitiveProperties.MassTypeEnum.Mass, 0), out mass, out com, out it, out itCom);
            CenterOfMass     = new Vector3(0, 0, -.5f);
            CenterOfPressure = new Vector3(0, 0, 0.0f);

            Vector3 LeftWingLiftLocation = 4 * Vector3.Left;

            LeftWingLiftLocation.Z = CenterOfPressure.Z;
            Vector3 RightWingLiftLocation = 4 * Vector3.Right;

            RightWingLiftLocation.Z = CenterOfPressure.Z;

            Thrust    = new BoostController(root.body, Vector3.Forward, 4 * Vector3.Forward, Vector3.Zero);
            LiftLeft  = new BoostController(root.body, Vector3.Up, LeftWingLiftLocation, Vector3.Zero); // this could be totally different than a force at a position (midwing)
            LiftRight = new BoostController(root.body, Vector3.Up, RightWingLiftLocation, Vector3.Zero);
            Elevator  = new BoostController(root.body, Vector3.Zero, Vector3.Backward * 3, Vector3.Zero);
            Drag      = new BoostController(root.body, Vector3.Zero, Vector3.Zero, Vector3.Zero);

            Yaw             = new BoostController(root.body, Vector3.Zero, Vector3.UnitY);
            Drag.worldForce = true;

            AddController(Thrust);
            AddController(LiftLeft);
            AddController(LiftRight);
            AddController(Drag);
            AddController(Elevator);

            actionManager.AddBinding((int)Actions.Thrust, new GameHelper.Input.ActionBindingDelegate(SimulateThrust), 1);
            actionManager.AddBinding((int)Actions.Aileron, new GameHelper.Input.ActionBindingDelegate(SimulateAileron), 1);
            actionManager.AddBinding((int)Actions.Elevator, new GameHelper.Input.ActionBindingDelegate(SimulateElevator), 1);
        }
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        BoostController   = new BoostController(_boostView);
        MoneyController   = new MoneyController(_moneyView, BoostController);
        ShopController    = new ShopController(_listOfBoosts, _shopView);
        ManagerController = new ManagerController(_listOfManagers, _managerView);

        if (_useClearSavegame)
        {
            PlayerPrefs.SetFloat("money", 3000);
        }

        float oldMoney = PlayerPrefs.GetFloat("money");

        MoneyController.AddMoney(oldMoney);
    }
Esempio n. 3
0
        public void Get_Detail_Improvement_TacticType_Boost_for_New_TacticType()
        {
            var routes = new RouteCollection();

            Console.WriteLine("Get Deatail Improvement Tactic Type for Boost.\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            int ModelId = DataHelper.GetModelId();

            Sessions.User.CID = DataHelper.GetClientId(0, ModelId);

            var result = objBoostController.DetailImprovementTacticData(0) as PartialViewResult;

            Assert.IsNotNull(result.ViewName);
            var serializedData = new RouteValueDictionary(result.ViewData);
            var resultvalue    = serializedData["Title"];
            var resultvalue1   = serializedData["CanDelete"];
            var resultvalue2   = serializedData["IsCreated"];

            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value:  " + " Title: " + resultvalue.ToString());
            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value:  " + " CanDelete: " + resultvalue1.ToString());
            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value:  " + " IsCreated: " + resultvalue2.ToString());
            Assert.IsNotNull(resultvalue.ToString());
            Assert.IsNotNull(resultvalue1.ToString());
            Assert.IsNotNull(resultvalue2.ToString());
        }
Esempio n. 4
0
        public void Save_Improvement_TacticType_Old()
        {
            var routes = new RouteCollection();

            Console.WriteLine("Save Improvement Tactic Type Details for Existing Tactic Type.\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            int ModelId = DataHelper.GetModelId();

            Sessions.User.CID = DataHelper.GetClientId(0, ModelId);

            ImprovementTacticType ImprovementTacticTypeData = DataHelper.GetImprovementTacticType(Sessions.User.CID);

            if (ImprovementTacticTypeData != null)
            {
                int    improvementId      = ImprovementTacticTypeData.ImprovementTacticTypeId;
                string improvementDetails = "[{\"StageId\":\"106\",\"StageType\":\"SV\",\"Value\":\"5\"}]";
                bool   status             = ImprovementTacticTypeData.IsDeleted;
                double cost  = ImprovementTacticTypeData.Cost;
                string desc  = ImprovementTacticTypeData.Description;
                string title = ImprovementTacticTypeData.Title;
                bool   deployToIntegrationStatus = ImprovementTacticTypeData.IsDeployedToIntegration;
                int    UserId = ImprovementTacticTypeData.CreatedBy;
                var    result = objBoostController.saveImprovementTacticData(improvementId, improvementDetails, status, cost, desc, title, deployToIntegrationStatus, UserId) as JsonResult;
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value result.Data:  " + result.Data);
                Assert.IsNotNull(result.Data);
            }
        }
Esempio n. 5
0
    private IEnumerator CalculateTimeChanges()
    {
        long old = long.Parse(PlayerPrefs.GetString("time", "0"));

        if (old < 1000)
        {
            yield break;
        }
        long now            = Technet99m.Clock.ActualTime;
        int  secondsElapsed = (int)(new TimeSpan(now - old).TotalSeconds);

        Debug.Log($"Elapsed: {Translator.TicksToTime(secondsElapsed)}");
        foreach (var cage in GameManager.Ins.cages)
        {
            if (cage.animals.Count > 0)
            {
                CalculateTimeForCage(cage, secondsElapsed);
            }
            yield return(null);
        }

        var boosts = JsonConvert.DeserializeObject <List <Boost> >(PlayerPrefs.GetString("boosts")).FindAll(x => x.ticksRemain > secondsElapsed);

        foreach (var b in boosts)
        {
            b.ticksRemain -= secondsElapsed;
        }
        BoostController.LoadBoosts(boosts);

        StateMachine.state = State.Game;
        GameManager.Ins.FinishLoading();
    }
Esempio n. 6
0
        public void Save_Improvement_TacticType_New()
        {
            var routes = new RouteCollection();

            Console.WriteLine("Save Improvement Tactic Type Details New Existing Tactic Type.\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            int ModelId = DataHelper.GetModelId();

            Sessions.User.CID = DataHelper.GetClientId(0, ModelId);
            Sessions.User.ID  = DataHelper.GetUserId(0, ModelId);

            int    improvementId      = 0;
            string improvementDetails = "[{\"StageId\":\"106\",\"StageType\":\"SV\",\"Value\":\"5\"}]";
            bool   status             = true;
            double cost  = 25000;
            string desc  = "";
            string title = "New Improvement Tactic Type Test 1234";
            bool   deployToIntegrationStatus = false;
            int    UserId = Sessions.User.ID;
            var    result = objBoostController.saveImprovementTacticData(improvementId, improvementDetails, status, cost, desc, title, deployToIntegrationStatus, UserId) as JsonResult;

            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + " \n The Assert Value result.Data:  " + result.Data);
            Assert.IsNotNull(result.Data);
        }
Esempio n. 7
0
        public LunarVehicle(Vector3 position, Vector3 scale, Matrix orient, Model model, int asset)
            : base()
        {
            Vector3 sides = new Vector3(1f * scale.X, 1.75f * scale.Y, 1f * scale.Z);

            Skin.AddPrimitive(new Box(new Vector3(sides.X * -.5f, sides.Y * -.5f, sides.Z * -.5f), orient, sides), (int)MaterialTable.MaterialID.NotBouncyNormal);   // Top portion
            sides = new Vector3(scale.X * 2.1f, scale.Y * 1.15f, scale.Z * 2.1f);
            Skin.AddPrimitive(new Box(new Vector3(sides.X * -.5f, sides.Y * -1.45f, sides.Z * -.5f), orient, sides), (int)MaterialTable.MaterialID.NotBouncyNormal); // Legs
            CommonInit(position, scale / 2, model, true, asset);

            VertJet = new BoostController(Body, Vector3.Up, Vector3.Zero);
            RotJetX = new BoostController(Body, Vector3.Zero, Vector3.UnitZ);
            RotJetZ = new BoostController(Body, Vector3.Zero, Vector3.UnitX);
            RotJetY = new BoostController(Body, Vector3.Zero, Vector3.UnitY);

            PhysicsSystem.CurrentPhysicsSystem.AddController(VertJet);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetX);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetZ);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetY);

            actionManager.AddBinding((int)Actions.ThrustUp, new Helper.Input.ActionBindingDelegate(GenericThrustUp), 1);
            actionManager.AddBinding((int)Actions.Pitch, new Helper.Input.ActionBindingDelegate(GenericPitch), 1);
            actionManager.AddBinding((int)Actions.Roll, new Helper.Input.ActionBindingDelegate(GenericRoll), 1);
            actionManager.AddBinding((int)Actions.Yaw, new Helper.Input.ActionBindingDelegate(GenericYaw), 1);
        }
Esempio n. 8
0
        public void Save_Deploye_Improvement_TacticType()
        {
            var routes = new RouteCollection();

            Console.WriteLine("Save Deployed Status for Improvement Tactic Type.\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            int ModelId = DataHelper.GetModelId();

            Sessions.User.CID = DataHelper.GetClientId(0, ModelId);
            ImprovementTacticType ImprovementTacticTypeData = DataHelper.GetImprovementTacticType(Sessions.User.CID);

            if (ImprovementTacticTypeData != null)
            {
                Sessions.User.ID = ImprovementTacticTypeData.CreatedBy;
                int  improvementId  = ImprovementTacticTypeData.ImprovementTacticTypeId;
                bool deploye        = ImprovementTacticTypeData.IsDeployed;
                int  UserId         = ImprovementTacticTypeData.CreatedBy;
                var  result         = objBoostController.SaveDeployedToIntegrationStatus(improvementId, deploye, UserId) as JsonResult;
                var  serializedData = new RouteValueDictionary(result.Data);
                var  resultvalue    = serializedData["message"];
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value result.data:  " + result.Data);
                Assert.IsNotNull(result.Data);
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value resultvalue :  " + resultvalue.ToString());
                Assert.IsNotNull(resultvalue.ToString());
            }
        }
Esempio n. 9
0
 // Use this for initialization
 void Start()
 {
     MSC        = MRacer.GetComponent <ShildController>();
     MBC        = MRacer.GetComponent <BoostController>();
     MSEC       = MRacer.GetComponent <SideEngineController>();
     shildAlarm = 1f;
     salarm     = false;
 }
Esempio n. 10
0
    private void Awake()
    {
        O2Controller    = GetComponent <O2Controller>();
        BoostController = GetComponent <BoostController>();
        SmokeController = GetComponent <SmokeController>();

        gotHome  = false;
        speedAux = speed;
    }
Esempio n. 11
0
        public LunarVehicle(Vector3 position, Vector3 scale, Primitive primitive, Model model, string asset)
            : base(position, scale, primitive, model, true, asset)
        {
            VertJet = new BoostController(Body, Vector3.Up, Vector3.Zero);
            RotJetX = new BoostController(Body, Vector3.Zero, Vector3.UnitZ);
            RotJetZ = new BoostController(Body, Vector3.Zero, Vector3.UnitX);
            RotJetY = new BoostController(Body, Vector3.Zero, Vector3.UnitY);

            PhysicsSystem.CurrentPhysicsSystem.AddController(VertJet);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetX);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetZ);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetY);

            //actionManager.AddBinding(Actions.
        }
Esempio n. 12
0
        public LunarVehicle(Vector3 position, Vector3 scale, Primitive primitive, Model model, string asset)
            : base(position, scale, primitive, model, true, asset)
        {
            VertJet = new BoostController(Body, Vector3.Up, Vector3.Zero);
            RotJetX = new BoostController(Body, Vector3.Zero, Vector3.UnitZ);
            RotJetZ = new BoostController(Body, Vector3.Zero, Vector3.UnitX);
            RotJetY = new BoostController(Body, Vector3.Zero, Vector3.UnitY);

            PhysicsSystem.CurrentPhysicsSystem.AddController(VertJet);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetX);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetZ);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetY);

            //actionManager.AddBinding(Actions.
        }
Esempio n. 13
0
    public float boostPercentage = 0f; //from 0 to 100 of course

    private void Awake()
    {
        lock (padlock)
        {
            if (_instance != null && _instance != this)
            {
                Destroy(this.gameObject);
            }
            else
            {
                _instance = this;
                //Here any additional initialization should occur:
            }
        }
        //DontDestroyOnLoad(this.gameObject);
    }
Esempio n. 14
0
    // Use this for initialization
    void Start()
    {
        MBC         = MRacer.GetComponent <BoostController>();
        MSEC        = GetComponent <SideEngineController>();
        timeBooster = 1f;


        rT.Stop();
        lT.Stop();
        rbT.Stop();
        lbT.Stop();
        dustcoll.Stop();
        onBoost      = false;
        onsideEngine = false;
        sideEngineOn = false;
        airbreak     = false;
        tiltAroundX  = 0;
        counterXRo   = 0;
    }
Esempio n. 15
0
        public void Index()
        {
            var routes = new RouteCollection();

            Console.WriteLine("Action to show Improvement Tactic Type list..\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            int ModelId = DataHelper.GetModelId();

            Sessions.User.CID = DataHelper.GetClientId(0, ModelId);
            var result = objBoostController.Index() as ActionResult;

            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value result:  " + result);
            Assert.IsNotNull(result);
        }
Esempio n. 16
0
        public void Best_In_Class()
        {
            var routes = new RouteCollection();

            Console.WriteLine("To Return BestInClass View.\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            var result = objBoostController.BestInClass() as ViewResult;
            List <BestInClassModel> objModelList = (List <BestInClassModel>)result.Model;
            BestInClassModel        objModel     = objModelList.FirstOrDefault();
            var serializedData = new RouteValueDictionary(objModel);
            var resultvalue    = serializedData["StageName"];

            Assert.IsNotNull(result.Model);
            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value: result.Model  " + result.Model);
            Assert.IsNotNull(resultvalue.ToString());
            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value: resultvalue " + resultvalue.ToString());
        }
Esempio n. 17
0
        public void Save_BIC()
        {
            var routes = new RouteCollection();

            Console.WriteLine("Action to Save BIC.\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            int ModelId = DataHelper.GetModelId();

            Sessions.User.CID = DataHelper.GetClientId(0, ModelId);
            int StageId  = DataHelper.GetStageId(Sessions.User.CID);
            var TaskData = DataHelper.GetStageData(StageId);
            List <BestInClassModel> objBestinClassModelList = new List <BestInClassModel>();
            BestInClassModel        objBestinClassModel     = new BestInClassModel();

            objBestinClassModel.StageID_CR      = StageId;
            objBestinClassModel.StageID_SV      = StageId;
            objBestinClassModel.StageID_Size    = StageId;
            objBestinClassModel.StageName       = "CR";
            objBestinClassModel.StageType       = Enums.StageType.CR.ToString();
            objBestinClassModel.ConversionValue = 10.0;
            objBestinClassModel.VelocityValue   = 10.0;

            objBestinClassModelList.Add(objBestinClassModel);

            if (objBestinClassModelList != null && objBestinClassModelList.Count > 0)
            {
                var result = objBoostController.SaveBIC(objBestinClassModelList) as JsonResult;
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value result.data:  " + result.Data);
                Assert.IsNotNull(result.Data);
            }
        }
Esempio n. 18
0
        public LunarVehicle(Vector3 position, Vector3 scale, Matrix orient, Model model, int asset)
            : base()
        {
            Vector3 sides = new Vector3(1f * scale.X, 1.75f * scale.Y, 1f * scale.Z);
            Skin.AddPrimitive(new Box(new Vector3(sides.X * -.5f, sides.Y * -.5f, sides.Z * -.5f), orient, sides), (int)MaterialTable.MaterialID.NotBouncyNormal); // Top portion
            sides = new Vector3(scale.X * 2.1f, scale.Y * 1.15f, scale.Z * 2.1f);
            Skin.AddPrimitive(new Box(new Vector3(sides.X * -.5f, sides.Y * -1.45f, sides.Z * -.5f), orient, sides), (int)MaterialTable.MaterialID.NotBouncyNormal); // Legs
            CommonInit(position, scale / 2, model, true, asset);

            VertJet = new BoostController(Body, Vector3.Up, Vector3.Zero);
            RotJetX = new BoostController(Body, Vector3.Zero, Vector3.UnitZ);
            RotJetZ = new BoostController(Body, Vector3.Zero, Vector3.UnitX);
            RotJetY = new BoostController(Body, Vector3.Zero, Vector3.UnitY);

            PhysicsSystem.CurrentPhysicsSystem.AddController(VertJet);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetX);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetZ);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetY);

            actionManager.AddBinding((int)Actions.ThrustUp, new Helper.Input.ActionBindingDelegate(GenericThrustUp), 1);
            actionManager.AddBinding((int)Actions.Pitch, new Helper.Input.ActionBindingDelegate(GenericPitch), 1);
            actionManager.AddBinding((int)Actions.Roll, new Helper.Input.ActionBindingDelegate(GenericRoll), 1);
            actionManager.AddBinding((int)Actions.Yaw, new Helper.Input.ActionBindingDelegate(GenericYaw), 1);
        }
Esempio n. 19
0
        public void Get_Improvement_TacticType_List_Boost()
        {
            var routes = new RouteCollection();

            Console.WriteLine("Get Improvement Tactic Type list for Boost.\n");
            MRPEntities db = new MRPEntities();

            HttpContext.Current = DataHelper.SetUserAndPermission();
            BoostController objBoostController = new BoostController();

            objBoostController.ControllerContext = new ControllerContext(MockHelpers.FakeUrlHelper.FakeHttpContext(), new RouteData(), objBoostController);
            objBoostController.Url = MockHelpers.FakeUrlHelper.UrlHelper();
            int ModelId = DataHelper.GetModelId();

            Sessions.User.CID = DataHelper.GetClientId(0, ModelId);
            var result         = objBoostController.ImprovementTacticList() as JsonResult;
            var serializedData = new RouteValueDictionary(result.Data);
            var resultvalue    = serializedData["Count"];

            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value result.Data:  " + result.Data);
            Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n The Assert Value resultvalue:  " + resultvalue.ToString());
            Assert.IsNotNull(result.Data);
            Assert.IsNotNull(resultvalue.ToString());
        }
Esempio n. 20
0
	void Awake()
	{
		instance = this;
	}
Esempio n. 21
0
 private void Awake()
 {
     Instance = this;
 }
Esempio n. 22
0
        private void Initialize()
        {
            //float mass;
            //Vector3 com;
            //Matrix it, itCom;
            //Skin.GetMassProperties(new PrimitiveProperties( PrimitiveProperties.MassDistributionEnum.Shell, PrimitiveProperties.MassTypeEnum.Mass, 0), out mass, out com, out it, out itCom);
            CenterOfMass = new Vector3(0, 0, -.5f);
            CenterOfPressure = new Vector3(0, 0, 0.0f);

            Vector3 LeftWingLiftLocation = 4 * Vector3.Left;
            LeftWingLiftLocation.Z = CenterOfPressure.Z;
            Vector3 RightWingLiftLocation = 4 * Vector3.Right;
            RightWingLiftLocation.Z = CenterOfPressure.Z;

            Thrust = new BoostController(Body, Vector3.Forward, 4 * Vector3.Forward, Vector3.Zero);
            LiftLeft = new BoostController(Body, Vector3.Up, LeftWingLiftLocation, Vector3.Zero);  // this could be totally different than a force at a position (midwing)
            LiftRight = new BoostController(Body, Vector3.Up, RightWingLiftLocation, Vector3.Zero);
            Elevator = new BoostController(Body, Vector3.Zero, Vector3.Backward * 3, Vector3.Zero);
            Drag = new BoostController(Body, Vector3.Zero, Vector3.Zero, Vector3.Zero);

            Yaw = new BoostController(Body, Vector3.Zero, Vector3.UnitY);
            Drag.worldForce = true;

            AddController(Thrust);
            AddController(LiftLeft);
            AddController(LiftRight);
            AddController(Drag);
            AddController(Elevator);

            actionManager.AddBinding((int)Actions.Thrust, new Helper.Input.ActionBindingDelegate(SimulateThrust), 1);
            actionManager.AddBinding((int)Actions.Aileron, new Helper.Input.ActionBindingDelegate(SimulateAileron), 1);
            actionManager.AddBinding((int)Actions.Elevator, new Helper.Input.ActionBindingDelegate(SimulateElevator), 1);
        }
 public MoneyController(MoneyView mv, BoostController boostController)
 {
     _moneyView       = mv;
     _boostController = boostController;
 }
	// Use this for initialization
	void Start () {
		boostController = gameObject.GetComponent<BoostController> ();

		Destroy (this, timeOfEffect);
	}
Esempio n. 25
0
    // Use this for initialization
    void Start()
    {
        boostController = gameObject.GetComponent <BoostController> ();

        Destroy(this, timeOfEffect);
    }
Esempio n. 26
0
 // Use this for initialization
 void Start()
 {
     MHM   = MRacer.GetComponent <HoverMotor>();
     SCtrl = MRacer.GetComponent <ShildController>();
     BCtrl = MRacer.GetComponent <BoostController>();
 }
Esempio n. 27
0
        public virtual void DrawWireframe(GraphicsDevice Graphics, Matrix View, Matrix Projection)
        {
            try
            {
                VertexPositionColor[] wireFrame = Skin.GetLocalSkinWireframe();
                Body.TransformWireframe(wireFrame);
                if (Effect == null)
                {
                    Effect = new BasicEffect(Graphics);
                    Effect.VertexColorEnabled = true;
                }
                Effect.TextureEnabled  = false;
                Effect.LightingEnabled = false;
                Effect.View            = View;
                Effect.Projection      = Projection;

                foreach (EffectPass pass in Effect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    Graphics.DrawUserPrimitives <VertexPositionColor>(
                        Microsoft.Xna.Framework.Graphics.PrimitiveType.LineStrip,
                        wireFrame, 0, wireFrame.Length - 1);
                }

                VertexPositionColor[] Velocity = new VertexPositionColor[2];
                Velocity[0] = new VertexPositionColor(Body.Position, Color.Blue);
                Velocity[1] = new VertexPositionColor(Body.Position + Body.Velocity, Color.Red);

                foreach (EffectPass pass in Effect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    Graphics.DrawUserPrimitives <VertexPositionColor>(
                        Microsoft.Xna.Framework.Graphics.PrimitiveType.LineStrip,
                        Velocity, 0, Velocity.Length - 1);
                }

                foreach (Controller c in controllers)
                {
                    if (c is BoostController)
                    {
                        VertexPositionColor[] Force = new VertexPositionColor[2];
                        BoostController       bc    = c as BoostController;
                        Force[0] = new VertexPositionColor(bc.ForcePosition, Color.Green);
                        Force[1] = new VertexPositionColor(bc.ForcePosition + (bc.Force * bc.forceMag), Color.Yellow);
                        if (!bc.worldForce)
                        {
                            Body.TransformWireframe(Force);
                        }

                        VertexBuffer verts = new VertexBuffer(Graphics, VertexPositionColor.VertexDeclaration, Force.Length, BufferUsage.WriteOnly);
                        verts.SetData(Force);

                        foreach (EffectPass pass in Effect.CurrentTechnique.Passes)
                        {
                            pass.Apply();
                            Graphics.SetVertexBuffer(verts);
                            Graphics.DrawPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.LineStrip, 0, Force.Length - 1);

                            /*Graphics.DrawUserPrimitives<VertexPositionColor>(
                             *  Microsoft.Xna.Framework.Graphics.PrimitiveType.LineStrip,
                             *  Force, 0, Force.Length - 1, LightingVertexFormat.VertexDeclaration);*/
                        }
                    }
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.StackTrace);
            }
        }