コード例 #1
0
 private void Start()
 {
     _manager           = Manager.GetComponent <HexNodesManager>();
     _node              = _manager.ReturnClosestHexNode(transform.position);
     transform.position = _node.Position;
     _manager.RegisterRadationTile(this);
 }
コード例 #2
0
        void Start()
        {
            string turnManagerDebug = "TurnManager Start Info:\n";

            if (HexNodeManager != null)
            {
                _hexNodesManager = HexNodeManager.GetComponent <HexNodesManager>();
                if (_hexNodesManager == null)
                {
                    turnManagerDebug += "There was no HexNodesManager script bound to the given HexNodeManager instance!\n";
                }
                else
                {
                    turnManagerDebug += "Successfully linked the HexNodeManager to the TurnManager!\n";
                }
            }
            else
            {
                turnManagerDebug += "No HexNodeManager instance was supplied to the TurnManager!\n";
            }

            if (Player != null)
            {
                _player = Player.GetComponent <PlayerAgent>();
                if (_player == null)
                {
                    turnManagerDebug += "There was no PlayerAgent script bound to the given Player instance!\n";
                }
                else
                {
                    turnManagerDebug += "Successfully linked the PlayerAgent to the TurnManager!\n";
                }
            }
            else
            {
                turnManagerDebug += "No Player instance was supplied to the TurnManager!\n";
            }

            _enemies = new List <EnemyAgent>();

            //Setting up the cache
            _phases = new Dictionary <Type, TurnPhaseBase>();
            _phases.Add(typeof(TurnPhaseIdle), new TurnPhaseIdle(this, EnemyScanRadius));
            _phases.Add(typeof(TurnPhaseEnemyChange), new TurnPhaseEnemyChange(this));
            _phases.Add(typeof(TurnPhasePlayerSelection), new TurnPhasePlayerSelection(this, _player));
            _phases.Add(typeof(TurnPhasePlayerAction), new TurnPhasePlayerAction(this, _player));
            _phases.Add(typeof(TurnPhaseEnemySelection), new TurnPhaseEnemySelection(this, _currentEnemy));
            _phases.Add(typeof(TurnPhaseEnemyAction), new TurnPhaseEnemyAction(this, _currentEnemy));

            turnManagerDebug += "Phase Cache is initialized!";

            Debug.Log(turnManagerDebug);

            //Initializing the first state manually
            _currentPhase = _phases[typeof(TurnPhaseIdle)];
            _currentPhase.Start();
        }
コード例 #3
0
    private void LoadNavNodes()
    {
        HexCellInfoContainerList loadedNodes    = JsonUtility.FromJson <HexCellInfoContainerList>(FileAtPath("/Resources/" + LoadRootFolderName + "/data/HexNodes.json"));
        HexNodesManager          hexNodeManager = HexNodesManagerRef.GetComponent <HexNodesManager>();

        if (hexNodeManager != null)
        {
            hexNodeManager.SetNodesFromInfoContainer(loadedNodes.Data, true);
            Debug.Log("Successfully set the hexNode data!");
        }
        else
        {
            Debug.Log("The HexNodeManager reference does not have a HexNodeManager component!");
        }
    }
コード例 #4
0
 public virtual void Awake()
 {
     Manager = HexNodeManager.GetComponent <HexNodesManager>();
 }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     hnm = HexnodeManager.GetComponent <HexNodesManager>();
 }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     _manager    = Manager.GetComponent <HexNodesManager>();
     _pathfinder = _manager.Pathfinder;
 }