// Start is called before the first frame update void Start() { // make sure start position is centered targetPosition.x = Mathf.Round(gameObject.transform.position.x); targetPosition.y = Mathf.Floor(gameObject.transform.position.y) + 0.5f; startPosition = targetPosition; // load turn system TurnSystem = GameObject.Find("Turn-basedSystem").GetComponent <turnSystemScript>(); //create a turn for the enemy foreach (TurnClass tc in TurnSystem.playersGroup) { if (tc.playerGameObject.name == gameObject.name) { turnClass = tc; } } //set information for starting position tile var tiles = GameTiles.instance.tiles; if (tiles.TryGetValue(new Vector3Int(Mathf.RoundToInt(startPosition.x), Mathf.FloorToInt(startPosition.y), 0), out _tile)) { _tile.Occupied = true; _tile.Player = false; } if (gameObject.name.Equals("Ranged Enemy")) { ranged = true; } }
void Awake() { GameObject Rob = GameObject.Find("Rob"); GameObject Rob2 = GameObject.Find("Rob2"); realTurns = new TurnClass(Rob, Rob2); Debug.Log("executed the start line of playershooting"); realTurns.nextTurn(); }
private void Start() { turnSystem = GameObject.Find("TurnBasedSystem").GetComponent <TurnSystem>(); foreach (TurnClass tc in turnSystem.playersGroup) { if (tc.playerGameObject.name == gameObject.name) { turnClass = tc; } } }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); turnSystem = GameObject.Find("TurnSystem").GetComponent <TurnBasedSystem> (); gameObject.transform.parent.hasChanged = false; foreach (TurnClass tc in turnSystem.playersGroup) { if (tc.character.name == gameObject.name) { turnClass = tc; } } pos = gameObject.transform.position; }
void Start() { mRigidbody2D = GetComponent <Rigidbody2D>(); hitPoints = maxPoints; turnSystem = GameObject.Find("Turn-basedSystem").GetComponent <TurnSystem>(); foreach (TurnClass tc in turnSystem.playersGroup) { if (tc.playerGameObject.name == gameObject.name) { turnClass = tc; } } }
private void Start() { playerColl = this.GetComponent <CapsuleCollider>(); boardTurnSystem = GameObject.Find("Maze").GetComponent <RandoMazeBoard>(); maze = GameObject.Find("Maze").GetComponent <maze>(); move = GetComponent <keyMove2>(); NVM = GetComponent <navMashMove>(); //for each gameObject of Turnclass in the List of "Maze" foreach (TurnClass element in boardTurnSystem.playersGroup) { //if the gameObject Name matches the gameObject name in "Maze" /check if gameObject is registered in "Maze" //add reference of element instance into turnclass if (element.playerGameObject.name == gameObject.name) { turnClass = element; } } }
private void Start() { newPosition = transform.position; gridMeasures = FindObjectOfType <Grid>(); Debug.Log(gridMeasures.hexWidth); Debug.Log(gridMeasures.hexHeight); turnSystem = GameObject.Find("TurnBasedSystem").GetComponent <TurnSystem>(); turnClass.playerGameObject = GameObject.FindGameObjectWithTag("Player"); turnSystem.playersGroup.Add(turnClass); foreach (TurnClass tc in turnSystem.playersGroup) { if (tc.playerGameObject.name == gameObject.name) { turnClass = tc; } } }
// Use this for initialization void Start() { player = GameObject.Find("Player"); turnSystem = GameObject.Find("TurnSystem").GetComponent <TurnBasedSystem> (); foreach (GameObject node in GameObject.FindGameObjectsWithTag("Node")) // For each object in the scene tagged "Node"... { nodes.Add(node); // ...Add it to the list "nodes" } foreach (TurnClass tc in turnSystem.playersGroup) { if (tc.character.name == gameObject.name) { turnClass = tc; } } pos = gameObject.transform.position; }
void Start() { trailMemory [0] = gameObject.transform.position; //The trails become the player's position when starting the game. trailMemory [1] = gameObject.transform.position; foreach (GameObject node in GameObject.FindGameObjectsWithTag("Node")) // For each object in the scene tagged "Node"... { nodes.Add(node); // ...Add it to the list "nodes" } turnSystem = GameObject.Find("TurnSystem").GetComponent <TurnBasedSystem> (); foreach (TurnClass tc in turnSystem.playersGroup) { if (tc.character.name == gameObject.name) { turnClass = tc; } pos = gameObject.transform.position; // Assigning pos a value. At the start of the game, pos = where the player is so the player does not move. playerAnimator = gameObject.GetComponent <Animator> (); } }
// Start is called before the first frame update void Start() { Button endturn = endTurn.GetComponent <Button>(); endturn.onClick.AddListener(TurnEnder); Button wizardmove = wizardMove.GetComponent <Button>(); wizardmove.onClick.AddListener(MoveWizard); Button sacrificemove = sacrificeMove.GetComponent <Button>(); sacrificemove.onClick.AddListener(MoveSacrifice); boundAbilities.Add(hud.Ability1); boundAbilities.Add(hud.Ability2); boundAbilities.Add(hud.Ability3); for (int i = 0; i < 3; i++) { Debug.Log(boundAbilities[i]); if (PersistentData.abilities[i] == "Staff Whack") { staffWhack = boundAbilities[i]; } else if (PersistentData.abilities[i] == "Fiendish Wisp") { fiendishWisp = boundAbilities[i]; } else if (PersistentData.abilities[i] == "Vicious Slap") { viciousSlap = boundAbilities[i]; } else if (PersistentData.abilities[i] == "Forgotten Curse") { forgottenCurse = boundAbilities[i]; } else if (PersistentData.abilities[i] == "Infernal Bubble") { infernalBubble = boundAbilities[i]; } else if (PersistentData.abilities[i] == "Shady Switcheroo") { shadyswitcheroo = boundAbilities[i]; } else if (PersistentData.abilities[i] == "Shadow Step") { shadowstep = boundAbilities[i]; } } if (staffWhack != null) { Button staffwhack = staffWhack.GetComponent <Button>(); staffwhack.onClick.AddListener(UseStaffWhack); } if (shadyswitcheroo != null) { Button shadySwitcheroo = shadyswitcheroo.GetComponent <Button>(); shadySwitcheroo.onClick.AddListener(UseShadySwitcheroo); } if (fiendishWisp != null) { Button fiendishwisp = fiendishWisp.GetComponent <Button>(); fiendishwisp.onClick.AddListener(UseFiendishWisp); } if (forgottenCurse != null) { Button forgottencurse = forgottenCurse.GetComponent <Button>(); forgottencurse.onClick.AddListener(UseForgottenCurse); } if (infernalBubble != null) { Button infernalbubble = infernalBubble.GetComponent <Button>(); infernalbubble.onClick.AddListener(UseInfernalBubble); } if (shadowstep != null) { Button shadowStep = shadowstep.GetComponent <Button>(); shadowStep.onClick.AddListener(useshadowStep); } if (viciousSlap != null) { Button viciousslap = viciousSlap.GetComponent <Button>(); viciousslap.onClick.AddListener(useViciousSlap); } // GameObject.FindGameObjectWithTag("Music").GetComponent<GameMusic>().PlayBattleMusic(); // load turn system TurnSystem = GameObject.Find("Turn-basedSystem").GetComponent <turnSystemScript>(); foreach (TurnClass tc in TurnSystem.playersGroup) { if (tc.playerGameObject.name == gameObject.name) { turnClass = tc; } } }