示例#1
0
    void FixedUpdate()
    {
        float moveH = Input.GetAxis("LeftAnalogHorizontal" + player.ToString());
        float moveV = Input.GetAxis("LeftAnalogVertical" + player.ToString());

        transform.Translate(moveH * speed * Time.fixedDeltaTime, 0, -moveV * speed * Time.fixedDeltaTime);
    }
    public void Initialize(/*Add paramerters once game setup is designed*/ int playerNum /*Game Manager passes in the number of the player when instantiating the player manager*/) //this takes the place of start
    {
        currentHealth    = vehicleData.maxHealth;
        currentEnergy    = 0;
        currentMaxEnergy = intitialMaxEnergy;
        currentState     = PlayerState.Mulligan;

        checkpointsCleared = new bool[GameManager.gameManager.checkpoints.Count];


        cardManager.playerManager = this; //gives the card manager a reference to itself
        cardManager.Initialize();         //calls the initialize method in the card manager

        vMan.playerManager = this;
        vMan.Initialize();

        weaponManager.playerManager = this;
        weaponManager.Initialize();

        buffsToRemove = new List <Buff>();

        camSetup.SetupCamera(id.ToString());

        healthBar.value = (currentHealth / GetCurrentStatValue(PlayerStat.MaxHealth));
        healthText.text = currentHealth.ToString();
        energyBar.value = (currentEnergy / currentMaxEnergy);
        energyText.text = currentEnergy.ToString();
    }
示例#3
0
    void SetKeyAndSprite(PlayerID id, HandType hand)
    {
        GameObject playerHand = GameObject.Find(id.ToString() + hand.ToString());

        key          = playerHand.transform.Find("Key").gameObject;
        keyText      = key.GetComponent <Graphic>();
        weaponSprite = playerHand.transform.Find("WeaponSprite").GetComponent <Image>();
        weaponText   = playerHand.transform.Find("WeaponName").GetComponent <Text>();
    }
示例#4
0
    public void Ready(PlayerID id)
    {
        Debug.Log("LaunchPad " + role.ToString() + " -> Player " + id.ToString());
        readyID = id;

        SpaceStationManager.stationManager.PadReady(this);

        _spriteRenderer.color = Color.white;
    }
示例#5
0
 //Get Damage
 void Dead()
 {
     if (isDefend)
     {
         return;
     }
     AudioSource.PlayClipAtPoint(ObjectPool._instance.PlayerTankDieAudio, transform.position);
     Instantiate(ObjectPool._instance.TankExplosion, transform.position, Quaternion.identity);
     GameManager.gameManager.StartCoroutine("Player" + PlayerID.ToString() + "Spawn");
     UIController._instance.SendMessage("LifeChange");
     Destroy(gameObject);
 }
示例#6
0
    // The players personal GUI
    void SetUpPlayersGUI()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        _uiManager.GetComponent <Canvas>().enabled = true;

        playerIDText.text   = PlayerID.ToString();
        playerNameText.text = _playerManager.GetPlayerName();
        seedNumText.text    = GlobalSeed.ToString();
    }
示例#7
0
    public float GetPlayerInput(PlayerID id)
    {
        string stringID = id.ToString();

        float horizontalInput = Input.GetAxisRaw(stringID + " Keyboard");

        if (horizontalInput == 0)
        {
            horizontalInput = Input.GetAxisRaw(stringID);
        }

        return(horizontalInput);
    }
示例#8
0
    private void Awake()
    {
        var fileName = playerID.ToString() + "KeysSettings.json";

        if (!IOHandler.FileExists(fileName))
        {
            Debug.LogError("The " + fileName + " file does not exist");
            return;
        }

        var jsonData = IOHandler.LoadFile <KeysSettings>(fileName);

        KeysSettings = jsonData;
    }
示例#9
0
        private Guid GetOrSetPlayerID(string SessionId)
        {
            Guid PlayerID = new Guid();

            if (Request.Cookies.ContainsKey(SessionId + "_PlayerID"))
            {
                PlayerID = new Guid(Request.Cookies[SessionId + "_PlayerID"]);
            }
            else
            {
                PlayerID = Guid.NewGuid();
                SetCookie(SessionId + "_PlayerID", PlayerID.ToString(), null, true);
            }
            return(PlayerID);
        }
示例#10
0
 public static bool GetButtonDown(string inputName, PlayerID playerId = PlayerID.Any)
 {
     if (playerId == PlayerID.Any)
     {
         foreach (var id in playerIds)
         {
             if (Input.GetButtonDown(inputName + '_' + id.ToString()))
             {
                 return(true);
             }
         }
         return(false);
     }
     return(Input.GetButtonDown(inputName + '_' + playerId.ToString()));
 }
示例#11
0
    public void EndGame()
    {
        SetGameState(GameState.END);
        if (winnerId == PlayerID.EMPTY)
        {
            winnerTxt.text = "Draw!";
        }
        else
        {
            winnerTxt.text = "" + winnerId.ToString() + " wins!";
        }
        uiManager.OpenEndDialog();

        spawnManager.CleanUp();
        spawnManager2.CleanUp();
    }
示例#12
0
    void Update()
    {
        //tests the acceleration button, "right trigger"
        //uses an axis, but only ever goes one direction
        speed = Input.GetAxis("RightTrigger" + player.ToString());
        if (speed != 0)
        {
            Debug.Log("Accelerate! (RT) " + player.ToString());
        }


        //tests the reverse button, "left trigger"
        //uses an axis, but only ever goes one direction
        stopSpeed = Input.GetAxis("LeftTrigger" + player.ToString());
        if (stopSpeed != 0)
        {
            Debug.Log("Backing up! (LT) " + player.ToString());
        }


        //tests the hand-break button, "left bumper"
        if (Input.GetButtonDown("LeftBumper" + player.ToString()))
        {
            Debug.Log("Brake! (LB) " + player.ToString());
        }


        //tests the fire button, "right bumper"
        if (Input.GetButtonDown("RightBumper" + player.ToString()))
        {
            Debug.Log("Fire! (RB) " + player.ToString());
        }


        //tests the play-a-card button, "A button"
        if (Input.GetButtonDown("ButtonA" + player.ToString()))
        {
            Debug.Log("Play Card! (A) " + player.ToString());
        }


        //tests the card-slot-1 button, "X button"
        if (Input.GetButtonDown("ButtonX" + player.ToString()))
        {
            Debug.Log("Play Card 1! (X) " + player.ToString());
        }


        //tests the card-slot-2 button, "Y button"
        if (Input.GetButtonDown("ButtonY" + player.ToString()))
        {
            Debug.Log("Play Card 2! (Y) " + player.ToString());
        }


        //tests the card-slot-3 button, "B button"
        if (Input.GetButtonDown("ButtonB" + player.ToString()))
        {
            Debug.Log("Play Card 3! (B) " + player.ToString());
        }


        //tests the card-cycle button, "left/right direction (D) button"
        //uses an axis, right is positive one, left is negative one,
        xCycle = Input.GetAxis("DPadHorizontal" + player.ToString());
        if (xCycle > 0)
        {
            Debug.Log("Cycle Right! (DR +1) " + player.ToString());
        }
        else if (xCycle < 0)
        {
            Debug.Log("Cycle Left! (DL -1) " + player.ToString());
        }


        //tests the view-discard button, "up/down direction (D) button"
        //uses an axis, up is positive one, down is negative one,
        yCycle = Input.GetAxis("DPadVertical" + player.ToString());
        if (yCycle > 0)
        {
            Debug.Log("View/Hide Cards! (DU +1) " + player.ToString());
        }
        else if (yCycle < 0)
        {
            Debug.Log("Discard Cards! (DD -1) " + player.ToString());
        }


        //tests the steering joystick, "left/right joystick, on the left hand side (LS)"
        //uses an axis, right is positive one, left is negative one
        //also tests the "Vertical" input, which uses both default keybinds as well as the left joystick
        //joystick uses an axis, up is positive one, down is negative one
        steering = Input.GetAxis("LeftAnalogHorizontal" + player.ToString());
        vert     = Input.GetAxis("Vertical");
        if (steering > 0)
        {
            Debug.Log("Steer Right! (LSR +1) " + player.ToString());
        }
        else if (steering < 0)
        {
            Debug.Log("Steer Left! (LSL -1) " + player.ToString());
        }
        if (vert > 0)
        {
            Debug.Log("Joystick up! (LSU +1) " + player.ToString());
        }
        else if (vert < 0)
        {
            Debug.Log("Joystick down! (LSD -1) " + player.ToString());
        }


        //tests the camera-swivel joystick, "left/right/up/down joystick, on the right hand side (RS)"
        //uses an axis, right is positive one, left is negative one, up is negative one, down is positive one
        camH = Input.GetAxis("RightAnalogHorizontal" + player.ToString());
        if (camH > 0)
        {
            Debug.Log("Camera Look Right! (RSR +1) " + player.ToString());
        }
        else if (camH < 0)
        {
            Debug.Log("Camera Look Left! (RSL -1) " + player.ToString());
        }
        camV = Input.GetAxis("RightAnalogVertical" + player.ToString());
        if (camV < 0)
        {
            Debug.Log("Camera Look Up! (RSU -1) " + player.ToString());
        }
        else if (camV > 0)
        {
            Debug.Log("Camera Look Down! (RSD +1) " + player.ToString());
        }


        //tests the air-steer button, "LS click"
        if (Input.GetButtonDown("LeftAnalogClick" + player.ToString()))
        {
            Debug.Log("Air Steer?... (LS click) " + player.ToString());
        }


        //tests the rear-view button, "RS click"
        if (Input.GetButtonDown("RightAnalogClick" + player.ToString()))
        {
            Debug.Log("Rear View! (RS click) " + player.ToString());
        }

        //tests the pause button, "Start"
        if (Input.GetButtonDown("Start" + player.ToString()))
        {
            Debug.Log("Game Paused! (Start) " + player.ToString());
        }
    }
示例#13
0
	public void NextTurn(){
		Debug.Log ("starting next turn function");
		if (turn != PlayerID.NULL && GetPlayer (turn).control == Control.INPUT) {
			mouseInput.OnMouseLeftClickTile -=OnTileSelected;
			OnSelectedUnitChange-=SelectedUnitChange;
			OnSelectedSpellChange -= SelectedSpellChange;
		}
		if (turn == PlayerID.NULL) {
			turn = PlayerID.LEFT;
		} else if (turn == PlayerID.LEFT) {
			turn = PlayerID.RIGTH;
		} else {
			turn = PlayerID.LEFT;
		}
		List<Unit> units = GetPlayer (turn).troop.units;
		Hero hero = GetPlayer (turn).troop.hero;
		if (hero != null) {
			hero.actionPoints=1;
		}
		for (int i=0; i<units.Count; ++i){
			if (units[i]!=null){
				units[i].actionPoints=1;
				units[i].ableToMove=true;
				units[i].ableToAttack=true;
				for (int i2=0; i2<units[i].TriggableAbilities.Count; ++i2){
					if (units[i].TriggableAbilities[i2] is IOnTurnChangeTrigger ){
						((IOnTurnChangeTrigger) units[i].TriggableAbilities[i2]).OnTurnChange(grid.UnitsNode(units[i]));
					}
					if (units[i]==null){
						break;
					}
				}
			}
		}
		units = GetPlayer (turn, true).troop.units;
		for (int i=0; i<units.Count; ++i){
			if (units[i]!=null){
				units[i].ableToRetaliate=true;
				for (int i2=0; i2<units[i].TriggableAbilities.Count; ++i2){
					if (units[i].TriggableAbilities[i2] is IOnTurnChangeTrigger ){
						((IOnTurnChangeTrigger) units[i].TriggableAbilities[i2]).OnTurnChange(grid.UnitsNode(units[i]));
					}
					if (units[i]==null){
						break;
					}
				}
			}
		}
		if (OnTurnChange != null) {
			OnTurnChange (GetPlayer (turn));
		}
		Debug.Log ("next turn: " + turn.ToString());
		if (GetPlayer (turn).control == Control.INPUT) {
			StartCoroutine(WaitForAllActions(delegate{
				mouseInput.OnMouseLeftClickTile += OnTileSelected;
				OnSelectedUnitChange += SelectedUnitChange;
				OnSelectedSpellChange += SelectedSpellChange;
				mouseInput.enabled=true;
				NextUnit ();
			}));
		} else {
			mouseInput.enabled=false;
			StartCoroutine(WaitForAllActions(delegate{ai.PlayTurn (turn);}));
		}


	}
 public override string ToString()
 {
     return(string.Concat(PlayerID.ToString(), " ", DisplayName, " ", Score));
 }
示例#15
0
 public static float GetAxis(string inputName, PlayerID playerId)
 {
     return(Input.GetAxis(inputName + '_' + playerId.ToString()));
 }
示例#16
0
 public override string ToString()
 {
     return("PlayerID: " + PlayerID.ToString() + ", ID: " + ID.ToString() + ", Damage: " + Damage.ToString());
 }