Example #1
0
        /*
         * the bot handler is a wrapper for ai functionality. the state machine is still handled within the bot object itself but common functions are stored here
         * the bot handler is not a state machine. the only state it stores is related to reaction time
         * reaction time is also used by the state machine but the state machine and the bot handler have seperate clocks
         * the bot handler mostly uses reaction time to make turning the ship less accurate. any fuctions that involve reaction time take an argument whether it should be used
         * the controller object itself stores a lot of state data too, such as the direction it is turning
         * the bot handler contains a minimum of data itself. data is passed to it by the state machine
         * the state machine is responsible for populating the navList, the pathfinding system plots a course given various inputs. the bot handler is responsible for steering along that course
         * the bot handler has authority over the course. it can take shortcuts for example
         * the bot handler is not responsible for firing weapons, that is the responsibility of the state machine. its methods may be used for fire control in the state machine however
         * where possible the bot handler should not alter the parent transform or rigidbody directly. it should send instructions to the controller. this is not strictly enforced however
         * arguments are passed in the following order: references, required simple datatypes, optional datatypes
         * the parent controller should always be passed by reference and should come first in the arguments
         * when passing items by reference the item to be modified should be the first argument. where possible avoid modifiying multiple referenced objects
         */


        public BotHandler(Transform _transform, ref GameInput.Controller _myController, float _reactionTime = 0)
        {
            transform       = _transform;
            myController    = _myController;
            reactionTime    = _reactionTime;
            maxReactionTime = _reactionTime;
            misses          = maxMisses;
        }
Example #2
0
    /*public void SetController(ref GameInput.Controller _myController)
     * {
     *  myController = _myController;
     *  botHandler = new BotLogic.BotHandler(transform, ref myController);
     *  navSystem = arenaMaster.GetComponent<arenaGen>().navSystem;
     * }*/

    public void SetController(GameInput.Controller _myController)
    {
        myController = _myController;
        Debug.Log(myController.index);
        if (myController.index == -1)
        {
            isBot      = true;
            navSystem  = arenaMaster.GetComponent <arenaGen>().navSystem;
            botHandler = new BotLogic.BotHandler(transform, ref myController, reactionTime);
        }
    }
 void Start()
 {
     info       = new string[size, fields];
     info[0, 0] = "SABER";
     info[0, 1] = "An all around balanced design. \nPrimary weapon is a railgun with a low rate of fire and high damage. \nSecondary weapon is an emp equipped homing mine";
     info[1, 0] = "CENTURION";
     info[1, 1] = "A front line fighter, very effective in formations. \nPrimary weapon is a four shot burst rifle. \nSecondary weapon is a gravity bomb that does direct hull damage.";
     invert     = new string[2];
     invert[0]  = "\nInvert: off";
     invert[1]  = "\nInvert: on";
     SetInfo();
     controller = new GameInput.Controller(GameInput.ControllerType.xbox, -2);
     invertText.GetComponent <TMPro.TextMeshProUGUI>().text = invert[invertInd];
     ChangeSensitivity(0);
 }
Example #4
0
 public void SetController(GameInput.Controller _controller)
 {
     controller = _controller;
 }
Example #5
0
 public void SetPointerController(ref GameInput.Controller nextController)
 {
     controller = nextController;
 }
 void Update()
 {
     this.controller = Bootstrap.instance.gameInput.GetController();
     this.UpdateStates();
 }
 public void SetController(GameInput.Controller _controller)
 {
     controller  = _controller;
     playerIndex = controller.index;
 }
Example #8
0
 public Player(GameInput.Controller _controller, int _playerNum = 1, int _classIndex = 0)
 {
     playerNum  = _playerNum;
     controller = _controller;
     classIndex = _classIndex;
 }