public virtual void GetObjectBuilder(MyObjectBuilder_CubeGrid ob)
        {
            var thrustComp = CubeGrid.Components.Get <MyEntityThrustComponent>();

            ob.DampenersEnabled = thrustComp == null || thrustComp.DampenersEnabled;

            ConveyorSystem.SerializeLines(ob.ConveyorLines);
            if (ob.ConveyorLines.Count == 0)
            {
                ob.ConveyorLines = null;
            }

            if (WheelSystem != null)
            {
                ob.Handbrake = WheelSystem.HandBrake;
            }

            if (MySession.Static.Settings.EnableOxygen && MySession.Static.Settings.EnableOxygenPressurization)
            {
                ob.OxygenAmount = GasSystem.GetOxygenAmount();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ob.JumpDriveDirection = JumpSystem.GetJumpDriveDirection();
                ob.JumpRemainingTime  = JumpSystem.GetRemainingJumpTime();
            }
        }
Exemple #2
0
 public UnitMotor(IUnitInput input, JumpSystem jumpSystem, Rigidbody rb, UnitSettings settings)
 {
     this.input      = input;
     this.jumpSystem = jumpSystem;
     this.rb         = rb;
     this.settings   = settings;
 }
        public virtual void GetObjectBuilder(MyObjectBuilder_CubeGrid ob)
        {
            ob.DampenersEnabled = ThrustSystem.DampenersEnabled;

            ConveyorSystem.SerializeLines(ob.ConveyorLines);
            if (ob.ConveyorLines.Count == 0)
            {
                ob.ConveyorLines = null;
            }

            if (WheelSystem != null)
            {
                ob.Handbrake = WheelSystem.HandBrake;
            }

            if (MySession.Static.Settings.EnableOxygen)
            {
                ob.OxygenAmount = OxygenSystem.GetOxygenAmount();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ob.JumpDriveDirection = JumpSystem.GetJumpDriveDirection();
                ob.JumpElapsedTicks   = JumpSystem.GetJumpElapsedTicks();
            }
        }
        public virtual void Init(MyObjectBuilder_CubeGrid builder)
        {
            var thrustComp = CubeGrid.Components.Get <MyEntityThrustComponent>();

            if (thrustComp != null)
            {
                thrustComp.DampenersEnabled = builder.DampenersEnabled;
            }

            if (WheelSystem != null)
            {
                m_cubeGrid.SetHandbrakeRequest(builder.Handbrake);
            }

            if (MySession.Static.Settings.EnableOxygen)
            {
                GasSystem.Init(builder.OxygenAmount);
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.Init(builder.JumpDriveDirection, builder.JumpRemainingTime);
            }

            var thrustComponent = CubeGrid.Components.Get <MyEntityThrustComponent>();

            if (thrustComponent != null)
            {
                thrustComponent.MergeAllGroupsDirty();
            }
        }
        public void UpdateBeforeSimulation()
        {
            ProfilerShort.Begin("Thrusters");
            MyEntityThrustComponent thrustComp;

            if (CubeGrid.Components.TryGet(out thrustComp))
            {
                thrustComp.UpdateBeforeSimulation(false, Sync.IsServer || CubeGrid.GridSystems.ControlSystem.IsLocallyControlled);
            }
            ProfilerShort.End();

            // Only update gyros if there are gyros in the system
            if (GyroSystem.GyroCount > 0)
            {
                ProfilerShort.Begin("Gyros");
                GyroSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
            {
                ProfilerShort.Begin("Wheels");
                WheelSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            /*ProfilerShort.Begin("Conveyors");
             * ConveyorSystem.UpdateBeforeSimulation();
             * ProfilerShort.End();*/

            ProfilerShort.Begin("Control");
            ControlSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Cameras");
            CameraSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MySession.Static.Settings.EnableOxygen && MySession.Static.Settings.EnableOxygenPressurization)
            {
                ProfilerShort.Begin("Oxygen");
                GasSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ProfilerShort.Begin("Jump");
                JumpSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            ProfilerShort.Begin("Ship sounds");
            if (ShipSoundComponent != null)
            {
                ShipSoundComponent.Update();
            }
            ProfilerShort.End();
        }
 public virtual void AfterGridClose()
 {
     ConveyorSystem.AfterGridClose();
     if (MyPerGameSettings.EnableJumpDrive)
     {
         JumpSystem.AfterGridClose();
     }
     m_blocksRegistered = false;
 }
    // Use this for initialization
    void Awake()
    {
        //I am goint to father and after I look for the <JumpSystem> in children.
        myJumpSystem = GetComponentInParent <Components> ().GetComponentInChildren <JumpSystem> ();

        WORLD_DATA_SOUNDS_EFFECTS = FindObjectOfType <DATA_SOUNDS_EFFECTS> ();

        fatherComponents = GetComponentInParent <Components> ();
    }
        public virtual void AfterGridClose()
        {
            ConveyorSystem.AfterGridClose();
            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.AfterGridClose();
            }
            m_blocksRegistered = false;

            // Clear out gas system
            GasSystem = null;
        }
    // add new attacksystem here

    private void Start()
    {
        playerInput = unitSettings.IsPlayer ? new PlayerController() as IUnitInput: new SlimeController();

        jumpSystem = new JumpSystem();
        motor      = new UnitMotor(playerInput, jumpSystem, GetComponent <Rigidbody>(), unitSettings);

        if (cam != null)
        {
            playerCamInput = new PlayerController();
            camMotor       = new PlayerCamMotor(playerCamInput, GetComponent <Transform>(), cam, unitSettings);
        }
    }
Exemple #10
0
        public virtual void UpdateBeforeSimulation()
        {
            ProfilerShort.Begin("Thrusters and Gyro");
            MyEntityThrustComponent thrustComp;

            if (CubeGrid.Components.TryGet(out thrustComp))
            {
                thrustComp.UpdateBeforeSimulation();
            }

            GyroSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
            {
                ProfilerShort.Begin("Wheels");
                WheelSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            ProfilerShort.Begin("Conveyors");
            ConveyorSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Control");
            ControlSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Cameras");
            CameraSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MySession.Static.Settings.EnableOxygen)
            {
                ProfilerShort.Begin("Oxygen");
                GasSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ProfilerShort.Begin("Jump");
                JumpSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }
        }
    //Chamado antes do Strat, mesmo se estre script estiver desativado
    void Awake()
    {
        WorldCameraFollow = FindObjectOfType <CameraFollow> ();
        meuJumpSystem     = GetComponentInChildren <JumpSystem> ();
        meuAnimator       = GetComponentInChildren <Animator> ();
        meuRigidbody2D    = GetComponent <Rigidbody2D> ();

        for (int i = 0; i < minhasArmas.Length; i++)
        {
            minhasArmas [i].GetComponent <MudarPai> ().MudarMeuPai(lugarDasArmas[i]);
        }

        deslizando   = false;
        recarregando = false;
        abaixado     = false;
        possoPular   = true;
    }
        public virtual void Init(MyObjectBuilder_CubeGrid builder)
        {
            ThrustSystem.DampenersEnabled = builder.DampenersEnabled;

            if (WheelSystem != null)
            {
                WheelSystem.HandBrake = builder.Handbrake;
            }

            if (MySession.Static.Settings.EnableOxygen)
            {
                OxygenSystem.Init(builder.OxygenAmount);
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.Init(builder.JumpDriveDirection, builder.JumpElapsedTicks);
            }
        }
        public virtual void UpdateBeforeSimulation()
        {
            ProfilerShort.Begin("Thrusters and gyro");
            ThrustSystem.UpdateBeforeSimulation();
            GyroSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
            {
                ProfilerShort.Begin("Wheels");
                WheelSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            ProfilerShort.Begin("Conveyors");
            ConveyorSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Control");
            ControlSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Cameras");
            CameraSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MySession.Static.Settings.EnableOxygen)
            {
                ProfilerShort.Begin("Oxygen");
                OxygenSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ProfilerShort.Begin("Jump");
                JumpSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }
        }
Exemple #14
0
        public virtual void Init(MyObjectBuilder_CubeGrid builder)
        {
            var thrustComp = CubeGrid.Components.Get <MyEntityThrustComponent>();

            if (thrustComp != null)
            {
                thrustComp.DampenersEnabled = builder.DampenersEnabled;
            }

            if (WheelSystem != null)
            {
                WheelSystem.HandBrake = builder.Handbrake;
            }

            if (MySession.Static.Settings.EnableOxygen)
            {
                GasSystem.Init(builder.OxygenAmount);
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.Init(builder.JumpDriveDirection, builder.JumpElapsedTicks);
            }
        }
 // Use this for initialization
 void Awake()
 {
     myRigidbody2D = GetComponent <Rigidbody2D> ();
     myAnimator    = GetComponentInChildren <Animator> ();
     myJumpSystem  = GetComponentInChildren <JumpSystem> ();
 }