//Function for player to score public void SetPlayerScore(PlayerTypes playerType) { if (GameObject.FindGameObjectWithTag(playerType.ToString()).GetComponent <IReceivesReward <float> >() != null) { GameObject player = GameObject.FindGameObjectWithTag(playerType.ToString()) as GameObject; try { player.GetComponent <IReceivesReward <float> >().ReceiveReward(RewardTypes.EnemyKill, onKillReward); } catch (Exception e) { Debug.Log(e); } Debug.Log(playerType.ToString() + " rewarded " + onKillReward.ToString() + " points"); } }
// ---------------------------------------------------------------- // Serializing // ---------------------------------------------------------------- override public PropData ToData() { SnackData data = new SnackData { pos = pos, playerType = playerType.ToString(), travelMind = new TravelMindData(travelMind), }; return(data); }
public IPlayer Generate(PlayerTypes playerType) { switch (playerType) { case PlayerTypes.Human: return(new HumanPlayer()); case PlayerTypes.Random: return(new RandomPlayer()); case PlayerTypes.Tactical: return(new TacticalPlayer()); } throw new Exception($"No player implements the player type {playerType.ToString()}"); }
// ---------------------------------------------------------------- // Update // ---------------------------------------------------------------- private void OnGUI() { if (!isCharTrial) // Don't show ANYthing in a CharTrial. //GUI.color = Color.black; { GUIStyle style = new GUIStyle(); style.fontSize = 24; for (int i = 0; i < lineup.Lineup.Count; i++) { PlayerTypes pt = lineup.Lineup[i]; //GUI.color = lineup.CurrTypeIndex == i ? new Color(1,0.8f,0) : Color.black; style.fontStyle = lineup.CurrTypeIndex == i ? FontStyle.Bold : FontStyle.Normal; GUI.Label(new Rect(14, Screen.height - 40 - i * 30, 400, 80), pt.ToString(), style); } } }
public Player CreatePlayer(int x, int y, PlayerTypes type) { Transform parent = this.container.Find("Entities/Players"); GameObject obj = GameObject.Instantiate(prefabs.players[type]); obj.transform.SetParent(parent, false); obj.name = type.ToString(); //"Player"; Player player = obj.GetComponent<Player>(); player.Init(this, x, y, Color.white); player.type = type; return player; }
public static void SaveLastPlayedType(PlayerTypes _type) { SaveStorage.SetString(SaveKeys.LastPlayedPlayerType, _type.ToString()); }
private void SwapPlayerType(Player player) { PlayerTypes playerNewType = CharTypeInMe; PlayerTypes myNewType = player.PlayerType(); // Set Player's type! MyRoom.GameController.SetPlayerType(playerNewType); // Set/save my type! SetCharTypeInMe(myNewType); SaveStorage.SetString(SaveKeys.CharBarrelTypeInMe(MyRoom.MyRoomData, myIndex), myNewType.ToString()); // Reset timeWhenCanSensePlayer! timeWhenCanSensePlayer = Time.time + 0.1f; }
public RoomData GetPlayerTrialStartRoom(PlayerTypes pt) { string roomKey = pt.ToString() + "TrialStart"; // TEMP HARDCODED finding. return(GetRoomData(GameProperties.TEMP_TrialsWorldIndex, roomKey, false)); }
public static string IsPlayerTypeUnlocked(PlayerTypes playerType) { return("IsPlayerTypeUnlocked_" + playerType.ToString()); }