Example #1
0
 protected override void Awake() {
     base.Awake();
     UnityUtility.ValidateComponentPresence<Rigidbody>(gameObject);
     _shipGraphics = gameObject.GetSafeMonoBehaviour<ShipGraphics>();
     _fleetMgr = gameObject.GetSafeFirstMonoBehaviourInParents<FleetUnitCreator>();
     _fleetCmd = _fleetMgr.gameObject.GetSafeFirstMonoBehaviourInChildren<FleetCommand>();
     _selectionMgr = SelectionManager.Instance;
 }
Example #2
0
 protected override void Awake() {
     base.Awake();
     _fleetMgr = gameObject.GetSafeMonoBehaviour<FleetUnitCreator>();
     _fleetCmd = gameObject.GetSafeFirstMonoBehaviourInChildren<FleetCommand>();
     _trackingLabelFactory = TrackingWidgetFactory.Instance;
     Target = _fleetCmd.transform;
     InitializeHighlighting();
     maxAnimateDistance = 1; // FIXME maxAnimateDistance not used, this is a dummy value to avoid the warning in AGraphics
 }
 public static int AddFleetCommand(FleetCommand fc)
 {
     if (fcommands == null)
     {
         fcommands = new FleetCommand[4];
     }
     fcommands[fnumber] = fc;
     fnumber++;
     return(fnumber);
 }
Example #4
0
 protected override void Awake() {
     base.Awake();
     enabled = false;    // disabled behaviours aren't updated
     _fleetCmd = gameObject.GetSafeFirstMonoBehaviourInChildren<FleetCommand>();
     _fleetCmdTransform = _fleetCmd.transform;
     _fleetGraphics = gameObject.GetSafeMonoBehaviour<FleetGraphics>();
     ShipCaptains = gameObject.GetSafeMonoBehavioursInChildren<ShipCaptain>().ToList();
     _gameMgr = GameManager.Instance;
     _eventMgr = GameEventManager.Instance;
     _selectionMgr = SelectionManager.Instance;
     InitializeFleetIcon();
     Subscribe();
 }
    void Start()
    {
        GameObject   g  = new GameObject("fleetCommand1");
        FleetCommand fc = g.AddComponent <FleetCommand>();

        fc.SetNumber(1);
        fc.gates         = gatesCommand1;
        fc.frigatePrefab = frigatePref;
        GameMaster.AddFleetCommand(fc);

        g  = new GameObject("fleetCommand2");
        fc = g.AddComponent <FleetCommand>();
        fc.SetNumber(2);
        fc.gates         = gatesCommand2;
        fc.frigatePrefab = frigatePref;
        GameMaster.AddFleetCommand(fc);
    }
    public void AddCommand(bool resetCommands, FleetCommand fleetCommand)
    {
        //Debug.Log("Added: " + fleetCommand);
        if (resetCommands)
        {
            _fleetCommandQueue.ResetCommands();
            _fleetCommandQueue.fleetCommands.Add(fleetCommand);
        }
        else
        {
            _fleetCommandQueue.fleetCommands.Add(fleetCommand);
        }

        if (_fleetCommandQueue.CurrentFleetCommand == null)
        {
            _fleetCommandQueue.CurrentFleetCommand = fleetCommand;
        }
    }
    private void Update()
    {
        if (_fleetCommandQueue.fleetCommands.Count > 0)
        {
            FleetCommand fleetCommand = _fleetCommandQueue.CurrentFleetCommand;

            if (!fleetCommand.IsFinished())
            {
                fleetCommand.ExecuteCommand();
            }
            else
            {
                FleetCommand next = _fleetCommandQueue.SetNextFleetCommand();
                if (next == null)
                {
                    SetIdle();
                }
            }
        }
    }
Example #8
0
 private void UpdateLine(FleetCommand previous, FleetCommand current)
 {
     ActivateIfPossible();
     SetLineRendererColor();
 }
 public void SetFleetCommand(FleetCommand fc)
 {
     myFleetCommand = fc;
     gameObject.tag = "Command" + fc.GetNumber().ToString();
 }