// Use this for initialization void Start() { switch (playerNum) { case 1: color = PlayerColor.Blue; break; case 2: color = PlayerColor.Red; break; case 3: color = PlayerColor.Green; break; case 4: color = PlayerColor.Yellow; break; } saveColor(); left.playerNum = playerNum; right.playerNum = playerNum; left.other = right; right.other = left; left.selected = true; left.saveElement(); // right.modifier = modifier; right.selected = false; right.playerNum = playerNum; right.saveElement(); Debug.Log(GameInit.getPlayerElement(playerNum, 0).getName()); // activate(false); }
public KeyHandler(GameInit gameInit) { this.gameInit = gameInit; movementHandler = new MovementHandler(gameInit); actionHandler = new ActionHandler(); keyTime = new Dictionary<Keys, int>(); tempKeyTime = new Dictionary<Keys, int>(); environmentAnimation = false; jumping = false; sliding = false; pushing = false; walking = false; casting = false; draining = false; moveUpFlag = false; moveDownFlag = false; moveRightFlag = false; moveLeftFlag = false; pauseFlag = false; pushingCounter = 0; drainCounter = 0; drainRadius = 0; manipulatedObjects = new List<ManipulatableObject>(); drainTiles = new List<ZoneTile>(); }
/* * Constructor: called at the beginning of the game. * You may do initialization here. * * Parameter: * gameInit - contains a property named GameDescription, which itself contains a property named MyType. * MyType is of type Marker, which is an enum. Marker has three fields: UNMARKED, X and O. */ public Solution(GameInit gameInit) { random = new Random(); Console.WriteLine("C# Client"); Console.WriteLine("PlayerType: " + gameInit.GameDescription.MyType); }
public void TestConditional1() { var worldState = GameInit.CreateWorldState("Attributes/credibility_and_money"); var storyEventsScenario = new StoryEventsScenario("Attributes/test_story_effects"); var condScenario = new ConditionalEventsScenario("Scenarios/test_conditional", worldState); var cred = Attribs.GetAttribByName("Credibility"); var money = Attribs.GetAttribByName("Money"); worldState.JournalistState[cred] = 0; var scheduler = new PressEventScheduler(worldState, new DateTime(2016, 1, 1), new DateTime(2017, 2, 2), storyEventsScenario, condScenario); Assert.AreEqual(500, worldState.JournalistState[money]); var cond = scheduler.PopNextEvent(); Assert.IsNotNull(cond as CutsceneEvent); Assert.AreEqual("Unconditional conditional!", (cond as CutsceneEvent).Description); var evt = NextAsMultipleChoice(scheduler); evt.Apply(evt.Choices[1], worldState); Assert.AreEqual(250, worldState.JournalistState[cred]); evt = NextAsMultipleChoice(scheduler); Assert.AreEqual("Credibility is 250.", evt.Description); evt.Apply(evt.Choices[0], worldState); Assert.AreEqual(0, worldState.JournalistState[money]); evt = NextAsMultipleChoice(scheduler); evt.Apply(evt.Choices[0], worldState); Assert.AreEqual(275, worldState.JournalistState[cred]); Assert.IsNull(scheduler.PopNextEvent()); }
private void Awake() { instance = this; sceneName = SceneManager.GetActiveScene().name; float minx = Camera.main.ScreenToWorldPoint(Vector3.zero).x; float miny = Camera.main.ScreenToWorldPoint(Vector3.zero).y; width = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).x - minx; height = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).y - miny; headPre = Resources.Load <GameObject>("Prefabs/head"); head = Instantiate(headPre, initPosition1, Quaternion.identity); //Sprite headSprite = // = headSprite; if (Head.instance.sceneName == "Mode3") { Node.redius /= 2; } if (sceneName == "Mode4") { Node.scale /= 2; Node.redius /= 2; Head.instance.InitPos(60); } else { Head.instance.InitPos(30); } }
public override void activate(GameInit gameInit, Character interactingCharacter, int activationCode) { if (locked) { chatWindow = true; if (false) { messageBlockIndex = 1; locked = false; } else { messageBlockIndex = 0; } } else { finishedActivating = false; if (orientation == 0) { animation.setNewAnimation(2); } else { animation.setNewAnimation(3); } } }
/* * Constructor: called at the beginning of the game. * You may do initialization here. * * Parameter: * gameInit - contains a property named GameDescription, which itself contains a property named MyColor. * MyColor is of type PlayerColor, which is an enum. PlayerColor has two fields: RED and WHITE. */ public Solution(GameInit gameInit) { Console.WriteLine("C# Backgammon Client"); var color = gameInit.GameDescription.MyColor; Console.WriteLine("PlayerColor: " + color); this.me = (int)color; this.lastTurn = -1; this.lastCommand = null; if (color == PlayerColor.RED) { this.other = (int)PlayerColor.WHITE; this.direction = +1; this.start = 0; this.end = 23; } else { this.other = (int)PlayerColor.RED; this.direction = -1; this.start = 23; this.end = 0; } }
public void TestConditionalAttribsCompare() { var worldState = GameInit.CreateWorldState("Attributes/credibility_and_money"); var condScenario = new ConditionalEventsScenario("Scenarios/test_conditional_attribcmp", worldState); var cred = Attribs.GetAttribByName("Credibility"); var money = Attribs.GetAttribByName("Money"); worldState.JournalistState[cred] = 500; worldState.SetValue(money, 500); var scheduler = new PressEventScheduler(worldState, new DateTime(1605, 1, 1), new DateTime(2020, 2, 2), condScenario); Assert.IsNull(scheduler.PopNextEvent()); worldState.SetValue(money, 499); Assert.AreEqual("More credibility", scheduler.PopNextEvent().Name); Assert.IsNull(scheduler.PopNextEvent()); worldState.SetValue(money, 501); Assert.AreEqual("More money", scheduler.PopNextEvent().Name); Assert.IsNull(scheduler.PopNextEvent()); worldState.SetValue(cred, 100); worldState.SetValue(money, 101); Assert.IsNull(scheduler.PopNextEvent()); worldState.SetValue(money, 100); Assert.AreEqual("Little of both", scheduler.PopNextEvent().Name); Assert.IsNull(scheduler.PopNextEvent()); worldState.Date = new DateTime(2016, 12, 12); Assert.AreEqual("Late", scheduler.PopNextEvent().Name); Assert.IsNull(scheduler.PopNextEvent()); Assert.IsTrue(condScenario.IsTerminated); }
public void Awake() { if(playerNum > 2 && GameInit.playerNum <= 2 && playerNum > GameInit.playerNum) { this.gameObject.SetActive(false); return; } Debug.Log("Player Num: "+playerNum); GameInit.players [playerNum - 1] = this; facingRight = true; color = GameInit.getPlayerColor(playerNum); controllerNum = GameInit.getControllerNum(playerNum); // GameInit i = new GameInit (); elements [0] = GameInit.getPlayerElement(playerNum, 0); //new Earth(); elements [1] = GameInit.getPlayerElement(playerNum, 1);//new Air(); punchMaker(); // healthBarTrans = healthBar.GetComponent<RectTransform>() as RectTransform; // manaBarTrans = manaBar.GetComponent<RectTransform>() as RectTransform; // elementL.s /* * instantiate missile for player */ /* * instantiate wall for player */ }
void Awake() { display = GameObject.Find("Display"); displayPlayerChanger = display.GetComponent <ChangePlayerController>(); KeepScoreAndEndRoundButton.SetActive(false); gameInit = this.gameObject.transform.parent.GetComponent <GameInit>(); }
private void Awake() { if (instance != null) { Destroy(this); } instance = this; }
public static GameInit Instance() { if (null == _instance) { _instance = new GameInit(); } return(_instance); }
void Start() { _scheduler = GameInit.CreateEventScheduler(WorldStateProvider.State); _currentEvent = _scheduler.PopNextEvent(); if (_currentEvent != null) { _currentEvent.ProcessEvent(Processor); } }
void Start() { gameInit = GameObject.Find("Initialization").GetComponent <GameInit>(); audioSource = GetComponent <AudioSource>(); IsTied = false; StartCoroutine(Move()); }
private void Awake() { lineRenderer = GetComponent <LineRenderer>(); edgeCollider = GetComponent <EdgeCollider2D>(); edgeCollider.enabled = false; gameInit = GameObject.Find("Initialization").GetComponent <GameInit>(); }
public void OnGameInit(GameInit init) { Log("[IPC] Receive GameInit"); ScoreBoard = init.Board; MyAgents = init.MyAgents; EnemyAgents = init.EnemyAgents; TurnCount = init.Turns; AgentsCount = init.AgentsCount; }
public void updateLogic(GameInit gameInit, KeyHandler keyHandler, ContentHandler content) { if (gameInit.getGameState().getState() == 0) { } else if (gameInit.getGameState().getState() == 1) { updateFreeRoamLogic(gameInit, keyHandler, content); } }
// Use this for initialization void Start() { m_question = GameObject.Find("question").GetComponent <Text>(); m_reponse_a = GameObject.Find("reponse_A").GetComponentInChildren <Text>(); m_reponse_b = GameObject.Find("reponse_B").GetComponentInChildren <Text>(); m_reponse_c = GameObject.Find("reponse_C").GetComponentInChildren <Text>(); m_reponse_d = GameObject.Find("reponse_D").GetComponentInChildren <Text>(); m_Panel.SetActive(false); _questionList = GameInit.GetQuestionList(); }
static void CreateGameInit() { var gameinit = new GameInit() { HealingTiles = new List <string>() { "Assorted Terrain 2_32_416", "Assorted Terrain 2_0_352", "Assorted Terrain 2_32_352", "Assorted Terrain 2_64_352" }, Levels = new LevelInfo[1] { new LevelInfo { LevelFile = "wasteland", SpawnLoc = new Vector3Int(0, 0, 0) } }, PlayerDefines = new EntityDefines() { Attributes = new Attributes() { Strength = 2, MaxHP = 100, Speed = 3, Dexterity = 1, Intellect = 1 }, EntityLayers = new List <EntityLayer>() { new EntityLayer() { DrawLayer = 1, Layername = "female_black", Color = Color.white }, new EntityLayer() { DrawLayer = 2, Layername = "female_bangslong2", Color = Color.red }, new EntityLayer() { DrawLayer = 3, Layername = "female_pants", Color = Color.blue }, new EntityLayer() { DrawLayer = 4, Layername = "female_chainmail", Color = Color.white } }, SpawnLocation = new Vector3Int(0, 0, 0), OnDeath = new OnDeath() { ChangeTiles = new List <TileData>(), ChangePlayerAttributes = new Attributes() } } }; FileLoader.SaveAsJson($"{FileLoader.ModPath}/Game.init", gameinit); }
public void OnGameInit(GameInit init) { Log("[IPC] Receive GameInit"); ScoreBoard = init.Board; MyAgent1 = init.MeAgent1; MyAgent2 = init.MeAgent2; EnemyAgent1 = init.EnemyAgent1; EnemyAgent2 = init.EnemyAgent2; TurnCount = init.Turns; }
// Use this for initialization void Start() { trock = GetComponent <Trock_Control>(); initO = (GameObject)Instantiate(GameInitPoint); init = initO.GetComponent <GameInit> (); life = new GameObject[Life_Count]; lifepoint = Life_Count; txt = txtobject.GetComponent <TextMesh>(); txt.text = ""; micscript = MicObject.GetComponent <Mic>(); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { zoneContent = new ContentManager(Content.ServiceProvider, Content.RootDirectory); game = new GameInit(); contentHandler = new ContentHandler(zoneContent); keyHandler = new KeyHandler(); logicHandler = new LogicHandler(); paintHandler = new PaintHandler(); base.Initialize(); }
//private readonly Point MENU_DRAW_LOCATION = new Point(0, 0); //private Button currentButton; public PaintHandler(GameInit gameInit) { this.gameInit = gameInit; currentZoneImages = new List<Texture2D>(); fireUINumbers = new List<Texture2D>(); waterUINumbers = new List<Texture2D>(); natureUINumbers = new List<Texture2D>(); fireNumberLocations = new List<Vector2>(); waterNumberLocations = new List<Vector2>(); natureNumberLocations = new List<Vector2>(); }
// Use this for initialization void Awake() { if (_inst == null) { _inst = this; } else if (_inst != null) { Destroy(this.gameObject); //·ÀÖ¹Öظ´´´½¨ return; } BindUI(); }
public void backAdvanceMessage(GameInit gameInit) { MessageBlock mb = gameInit.getMessageBlockFactory().getObjectBlock(type); if (mb.getOptions(messageBlockIndex).Count == 0) { advanceMessage(gameInit); } else { optionIndex = mb.getOptions(messageBlockIndex).Count - 1; advanceMessage(gameInit); } }
private bool m_otherDependencies = false; //TODO: Add capability for other dependencies such as SO's. public override void OnInspectorGUI() { GameInit gameInit = target as GameInit; EditorGUI.BeginChangeCheck(); m_kodeboldBehvioursFoldout = EditorGUILayout.Foldout(m_kodeboldBehvioursFoldout, "Kodebold Behaviours"); if (m_kodeboldBehvioursFoldout) { EditorGUI.indentLevel++; for (int behaviourIndex = 0; behaviourIndex < gameInit.KodeboldBehaviours.Count; behaviourIndex++) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("-")) { gameInit.KodeboldBehaviours.RemoveAt(behaviourIndex); if (behaviourIndex >= gameInit.KodeboldBehaviours.Count) { continue; } } if (GUILayout.Button("+")) { gameInit.KodeboldBehaviours.Add(null); } gameInit.KodeboldBehaviours[behaviourIndex] = EditorGUILayout.ObjectField(gameInit.KodeboldBehaviours[behaviourIndex], typeof(KodeboldBehaviour), false) as KodeboldBehaviour; EditorGUILayout.EndHorizontal(); } if (gameInit.KodeboldBehaviours.Count == 0 && GUILayout.Button("Add New Behaviour")) { gameInit.KodeboldBehaviours.Add(null); } EditorGUI.indentLevel--; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(gameInit); } }
public InventoryKeyHandler(GameInit gameInit) { this.gameInit = gameInit; currentPage = PAGE1; keyDelay = 0; fadeCounter = 0; drawOffset = new Vector2(0, 0); fadingIn = false; fadingOut = false; fadeInOffset = new List<Vector2>(); fadeOutOffset = new List<Vector2>(); fillOffsets(); }
private void movePlayerLeft(int distance, GameInit gameInit) { if (leftDistance < MAX_MOVE) { if (leftDistance + distance >= MAX_MOVE) { gameInit.getPlayer().moveLeft(MAX_MOVE - leftDistance); } else { gameInit.getPlayer().moveLeft(distance); leftDistance += distance; } } }
/// <summary> /// Initalise the gmae by allowing players to join /// </summary> protected void InitGame() { gameState = GAME_STATE.WaitingForUsers; //Send a chat message TwitchChatClient.Instance.SendChatMessage(settings.gameName + " is now open! " + settings.minPlayerCount + " - " + settings.maxPlayerCount + " players must join in the next " + settings.maxWaitToStartTime + " seconds"); //Allow users to join playerList?.SetAllowJoin(true); //Start countdown initTimer = settings.maxWaitToStartTime; GameInit?.Invoke(); }
private void movePlayerDown(int distance, GameInit gameInit) { if (downDistance < MAX_MOVE) { if (downDistance + distance >= MAX_MOVE) { gameInit.getPlayer().moveDown(MAX_MOVE - downDistance); } else { gameInit.getPlayer().moveDown(distance); downDistance += distance; } } }
private void movePlayerUp(int distance, GameInit gameInit) { if (upDistance < MAX_MOVE) { if (upDistance + distance >= MAX_MOVE) { gameInit.getPlayer().moveUp(MAX_MOVE - upDistance); } else { gameInit.getPlayer().moveUp(distance); upDistance += distance; } } }
private void movePlayerRight(int distance, GameInit gameInit) { if (rightDistance < MAX_MOVE) { if (rightDistance + distance >= MAX_MOVE) { gameInit.getPlayer().moveRight(MAX_MOVE - rightDistance); } else { gameInit.getPlayer().moveRight(distance); rightDistance += distance; } } }
public void TestAttributesAndTermination() { var worldState = GameInit.CreateWorldState("Attributes/credibility_only"); var storyEventsScenario = new StoryEventsScenario("Attributes/test_story_effects"); var cred = Attribs.GetAttribByName("Credibility"); var scheduler = new PressEventScheduler(worldState, new DateTime(2016, 1, 1), new DateTime(2017, 2, 2), storyEventsScenario); var evt = NextAsMultipleChoice(scheduler); Assert.AreEqual(500, worldState.JournalistState[cred]); evt.Apply(evt.Choices[0], worldState); Assert.AreEqual(125, worldState.JournalistState[cred]); evt = NextAsMultipleChoice(scheduler); evt.Apply(evt.Choices[0], worldState); Assert.AreEqual(150, worldState.JournalistState[cred]); Assert.IsNull(scheduler.PopNextEvent()); }
public MovementHandler(GameInit gameInit) { this.gameInit = gameInit; transitionHandler = new TransitionHandler(gameInit); bump = false; upDistance = 0; downDistance = 0; rightDistance = 0; leftDistance = 0; leftFlag = false; rightFlag = false; upFlag = false; downFlag = false; }
public void play() { // int temp = XCI.GetNumPluggedCtrlrs(); // if(temp <= 1) // temp = 2; Debug.Log("Players: " + GameInit.playerNum); if (GameInit.playerNum < 2) { no.SetActive(true); no.GetComponent <NotEnoughPlayers>().Start(); return; } GameInit.consolidate(); GameInit.setNumPlayers(GameInit.playerNum); Application.LoadLevel("DefaultLevelScene"); }
public void executeAction(GameInit gameInit) { if (currentAction == ACTIVATE) { } else if (currentAction == ENTER) { } else if (currentAction == INSPECT) { } else if (currentAction == OPEN) { } else if (currentAction == TALK) { int direction = gameInit.getPlayer().getFacingDirection(); if (direction == 0) { interactingNPC.turn(1); interactingNPC.setNewAnimation(gameInit.getContentHandler().getNPCContentHandler().getNPCImages()[interactingNPC.getName()]["STATIONARY_DOWN"]); } else if (direction == 1) { interactingNPC.turn(0); interactingNPC.setNewAnimation(gameInit.getContentHandler().getNPCContentHandler().getNPCImages()[interactingNPC.getName()]["STATIONARY_UP"]); } else if (direction == 2) { interactingNPC.turn(3); interactingNPC.setNewAnimation(gameInit.getContentHandler().getNPCContentHandler().getNPCImages()[interactingNPC.getName()]["STATIONARY_LEFT"]); } else if (direction == 3) { interactingNPC.turn(2); interactingNPC.setNewAnimation(gameInit.getContentHandler().getNPCContentHandler().getNPCImages()[interactingNPC.getName()]["STATIONARY_RIGHT"]); } gameInit.getGameState().setChatState(); gameInit.getChatKeyHandler().fadeIn(interactingNPC); } }
public void advanceMessage(GameInit gameInit) { MessageBlock mb = gameInit.getMessageBlockFactory().getObjectBlock(type); int destination = mb.getDestination(messageBlockIndex)[optionIndex]; if (destination < 0) { if (destination == -1) { chatWindow = false; } else { item = true; } } else { messageBlockIndex = destination; optionIndex = 0; } }
public void Start() { gi = GameObject.Find("GameInitializer").GetComponent<GameInit>(); //hintType = 0; }
public void moveUpOptionIndex(GameInit gameInit) { MessageBlock mb = gameInit.getMessageBlockFactory().getObjectBlock(type); if (mb.getOptions(messageBlockIndex).Count == 0) { optionIndex = 0; } else { if (optionIndex == 0) { optionIndex = mb.getOptions(messageBlockIndex).Count - 1; } else { optionIndex--; } } }
public override void continueActivation(GameInit gameInit, Character interactingCharacter) { animation.advanceAnimation(); if (animation.isAnimationFinished()) { finishedActivating = true; } }
public override void finishActivation(GameInit gameInit) { transitionReady = true; }
public override void talk(GameInit gameInit) { gameInit.getFreeRoamState().setChatWindow(true); if (messageBlockIndex == 0) { gameInit.getFreeRoamState().setMessage(gameInit.getMessageBlockFactory().getObjectBlock(type).getMessage(messageBlockIndex)); gameInit.getFreeRoamState().setOptions(gameInit.getMessageBlockFactory().getObjectBlock(type).getOptions()[messageBlockIndex]); gameInit.getFreeRoamState().setParsedMessage(gameInit.getMessageBlockFactory().getObjectBlock(type).getParsedMessage(messageBlockIndex)); } else if (messageBlockIndex == 1) { gameInit.getFreeRoamState().setMessage(gameInit.getMessageBlockFactory().getObjectBlock(type).getMessage(messageBlockIndex)); // add key after gameInit.getFreeRoamState().setOptions(gameInit.getMessageBlockFactory().getObjectBlock(type).getOptions()[messageBlockIndex]); gameInit.getFreeRoamState().setParsedMessage(gameInit.getMessageBlockFactory().getObjectBlock(type).getParsedMessage(messageBlockIndex)); } }
// Use this for initialization void Start() { trock = GetComponent<Trock_Control>(); initO=(GameObject)Instantiate (GameInitPoint); init = initO.GetComponent<GameInit> (); life = new GameObject[Life_Count]; lifepoint = Life_Count; txt = txtobject.GetComponent<TextMesh>(); txt.text = ""; micscript = MicObject.GetComponent<Mic>(); }
public abstract void activate(GameInit gameInit, Character interactingCharacter, int activationCode);
// Leave awake for any preconfig void Awake() { instance = this; }
public override void talk(GameInit gameInit) { }
public abstract void finishActivation(GameInit gameInit);
public abstract void talk(GameInit gameInit);
public override void activate(GameInit gameInit, Character interactingCharacter, int activationCode) { }
/* * Constructor: called at the beginning of the game. * You may do initialization here. * * Parameter: * gameInit - not used for Wumpus */ public Solution(GameInit gameInit) { random = new Random(); Console.WriteLine("C# Client"); }
public InventoryPaintHandler(GameInit gameInit) { this.gameInit = gameInit; currentPage = PAGE1; }
public abstract void continueActivation(GameInit gameInit, Character interactingCharacter);
public ChatKeyHandler(GameInit gameInit) { this.gameInit = gameInit; keyDelay = 0; }
/* * Constructor: called at the beginning of the game. * You may do initialization here. * * Parameter: * gameInit - depends on the game. It will contain necessary information for initialization. */ public Solution(GameInit gameInit) { }
public ChatPaintHandler(GameInit gameInit) { this.gameInit = gameInit; distance = 0; line = 0; }
public override void continueActivation(GameInit gameInit, Character interactingCharacter) { }
public override void finishActivation(GameInit gameInit) { }