Inheritance: MonoBehaviour
Example #1
0
        public static bool checkopenUIWindow(Type T, EntityState _entityState, GlobalUIState _state)
        {
            //If the user has requested a menu be opened and if
            bool returnval;

            if (T == typeof(WarpOrderWindow))
            {
                returnval = WarpOrderWindow.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(ChangeCurrentOrbitWindow))
            {
                returnval = ChangeCurrentOrbitWindow.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(FireControl))
            {
                returnval = FireControl.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(RenameWindow))
            {
                returnval = RenameWindow.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(CargoTransfer))
            {
                returnval = CargoTransfer.GetInstance(_state.Game.StaticData, _entityState).GetActive();
            }
            else if (T == typeof(ColonyPanel))
            {
                returnval = ColonyPanel.GetInstance(_state.Game.StaticData, _entityState).GetActive();
            }
            else
            {
                returnval = false;
            }
            return(returnval);
        }
Example #2
0
 private void OnTriggerEnter(Collider other)
 {
     Debug.Log("Touching Something");
     if (other.CompareTag("Player"))
     {
         FireControl hit = other.transform.root.GetComponent <FireControl>();
         Debug.Log("It's a powerup");
         hit.count = 5f;
         Destroy(this.gameObject);
     }
 }
Example #3
0
    public static FireControl GetRandomFireControl()
    {
        FireControl p = new FireControl();

        p.sprite          = SpriteLoader.GetPartSprite("defaultFireControlS");
        p.tier            = Random.Range(1, 6);
        p.tracking.Value  = Random.Range(1, 20);
        p.accuracy.Value  = Random.Range(1, 20);
        p.Size            = PartSize.S;
        p.range.Value     = Random.Range(1, 20);
        p.DescriptionName = "Fire Control System";
        p.ModelName       = StringLoader.GetAString("fireControlNames");
        Debug.Log(p.GetDescriptionString());
        Debug.Log(p.GetStatisticsString());
        return(p);
    }
Example #4
0
    public override Part Clone()
    {
        FireControl      part          = (FireControl)MemberwiseClone();
        List <Tweakable> newTweakables = new List <Tweakable>();

        part.Manufacturer = Manufacturer;
        foreach (Tweakable t in tweakables)
        {
            Tweakable newt = Tweakable.MakeTweakable(
                part,
                t.tweakableType,
                t.tweakableName);
            newt.Value          = t.Value;
            newt.dropdownLabels = new List <string>(t.dropdownLabels);
            newTweakables.Add(newt);
        }
        part.tweakables = newTweakables;
        part.UpdateProperties();
        return(part);
    }
Example #5
0
 // Use this for initialization
 void Start()
 {
     body                    = transform.parent.Find("Base").gameObject;
     turretBase              = transform.parent.Find("TurretBase").gameObject;
     barrelBase              = transform.parent.Find("BarrelBase").gameObject;
     wheelController         = transform.parent.GetComponent <WheelControl>();
     turretController        = turretBase.transform.GetComponent <TurretSolver>();
     gunTarget               = turretBase.transform.position + turretBase.transform.forward * gunTargetDist;
     turretController.target = Vector3.zero;
     crosshairs              = GetComponentsInChildren <LineRenderer>();
     lastTransform           = turretBase.transform.position;
     barrelEnd               = transform.parent.Find("Barrel").gameObject;
     headerIcon              = transform.Find("TurretHeading").gameObject;
     gunCamera               = turretBase.transform.Find("Camera").gameObject.GetComponent <Camera>();
     fireCalc                = GetComponent <FireControl>();
     if (playerControlled)
     {
         //barrelBase.GetComponent<HingeJoint>().useMotor = true;
         turretBase.GetComponent <HingeJoint>().useMotor = true;
     }
 }
Example #6
0
        internal static void openUIWindow(Type T, EntityState _entityState, GlobalUIState _state, bool open = true, bool managesUIPopUps = false)
        {
            if (open)
            {
                //If the user has requested a menu be opened and if
                //Menu is pin menu
                if (T == typeof(PinCameraBlankMenuHelper))
                {
                    _state.Camera.PinToEntity(_entityState.Entity);
                    if (managesUIPopUps)
                    {
                        ImGui.CloseCurrentPopup();
                    }
                }
                //Menu is goto system menu
                else if (T == typeof(GotoSystemBlankMenuHelper))
                {
                    _state.SetActiveSystem(_entityState.Entity.GetDataBlob <JPSurveyableDB>().JumpPointTo.GetDataBlob <PositionDB>().SystemGuid);
                }
                else if (T == typeof(SelectPrimaryBlankMenuHelper))
                {
                    _state.EntitySelectedAsPrimary(_entityState.Entity.Guid, _entityState.StarSysGuid);
                }
                //if entity can warp
                else if (T == typeof(WarpOrderWindow))
                {
                    WarpOrderWindow.GetInstance(_entityState).ToggleActive();
                    _state.ActiveWindow = WarpOrderWindow.GetInstance(_entityState);
                }
                //Menu is change orbit menu
                else if (T == typeof(ChangeCurrentOrbitWindow))
                {
                    ChangeCurrentOrbitWindow.GetInstance(_entityState).ToggleActive();
                    _state.ActiveWindow = ChangeCurrentOrbitWindow.GetInstance(_entityState);
                }
                //Menu is ficrecontrol menu
                else if (T == typeof(FireControl))
                {
                    var instance = FireControl.GetInstance(_entityState);
                    //instance.SetOrderEntity(_entityState);
                    instance.ToggleActive();
                    _state.ActiveWindow = instance;
                }
                //Menu is rename menu
                else if (T == typeof(RenameWindow))
                {
                    RenameWindow.GetInstance(_entityState).ToggleActive();
                    _state.ActiveWindow = RenameWindow.GetInstance(_entityState);
                    if (managesUIPopUps)
                    {
                        ImGui.CloseCurrentPopup();
                    }
                }
                //Menu is cargo menu
                else if (T == typeof(CargoTransfer))
                {
                    var instance = CargoTransfer.GetInstance(_state.Game.StaticData, _entityState);
                    instance.ToggleActive();
                    _state.ActiveWindow = instance;
                }
                //Menu is econ menu
                else if (T == typeof(ColonyPanel))
                {
                    var instance = ColonyPanel.GetInstance(_state.Game.StaticData, _entityState);
                    instance.ToggleActive();
                    _state.ActiveWindow = instance;
                }
                //
                if (T == typeof(PlanetaryWindow))
                {
                    var instance = PlanetaryWindow.GetInstance(_entityState);
                    instance.ToggleActive();
                    _state.ActiveWindow = instance;

                    //TODO: implement this(moving a ship entity[_uiState.PrimaryEntity] from one system to another one and placing it at a given location[_entityState.Entity.GetDataBlob<JPSurveyableDB>().JumpPointTo.GetDataBlob<PositionDB>(). etc...])
                    if (T == typeof(JumpThroughJumpPointBlankMenuHelper))
                    {
                    }
                }
            }
        }