public void Start() { pOnePlayer = PCT.NONE; pTwoPlayer = PCT.NONE; displayOne = GameObject.Find("DisplayP1").GetComponent <Image>(); displayTwo = GameObject.Find("DisplayP2").GetComponent <Image>(); source = GetComponentInChildren <ChildImage>().GetComponent <Image>(); }
// Start is called before the first frame update void Start() { d = GameObject.Find(Damage); s = GameObject.Find(Stocks); playerOneChar = SelectCharacter.pOnePlayer; playerTwoChar = SelectCharacter.pTwoPlayer; SpawnPlayers(playerOneChar, playerTwoChar); }
public CharacterControl GetCharacter(PCT playableCharacterType) { foreach (CharacterControl control in Characters) { if (control.playableCharacterType == playableCharacterType) { return(control); } } return(null); }
void Update() { if ((this.GetComponent <BoxCollider2D>().bounds.Intersects(playerOne.GetComponent <CircleCollider2D>().bounds)) && (this.GetComponent <BoxCollider2D>().bounds.Intersects(playerTwo.GetComponent <CircleCollider2D>().bounds))) { this.GetComponent <Image>().color = new Color(255, 0, 0); this.GetComponentInChildren <CapsuleCollider2D>().gameObject.GetComponent <Image>().enabled = true; //Debug.Log("Both Players have selected " + this.name); pTwoPlayer = this.GetComponent <CharacterControl>().playableCharacterType; pOnePlayer = this.GetComponent <CharacterControl>().playableCharacterType; displayOne.GetComponent <Image>().sprite = source.sprite; displayTwo.GetComponent <Image>().sprite = source.sprite; } else if (this.GetComponent <BoxCollider2D>().bounds.Intersects(playerOne.GetComponent <CircleCollider2D>().bounds)) { this.GetComponent <Image>().color = new Color(255, 0, 0); this.GetComponentInChildren <CapsuleCollider2D>().gameObject.GetComponent <Image>().enabled = false; //Debug.Log("Player1 has selected " + this.name); pOnePlayer = this.GetComponent <CharacterControl>().playableCharacterType; displayOne.GetComponent <Image>().sprite = source.sprite; } else if (this.GetComponent <BoxCollider2D>().bounds.Intersects(playerTwo.GetComponent <CircleCollider2D>().bounds)) { this.GetComponent <Image>().color = new Color(0, 0, 255); this.GetComponentInChildren <CapsuleCollider2D>().gameObject.GetComponent <Image>().enabled = false; //Debug.Log("Player2 has selected " + this.name); pTwoPlayer = this.GetComponent <CharacterControl>().playableCharacterType; displayTwo.GetComponent <Image>().sprite = source.sprite; } else { this.GetComponent <Image>().color = new Color(0, 0, 0); this.GetComponentInChildren <CapsuleCollider2D>().gameObject.GetComponent <Image>().enabled = false; } }
public PCTAssignment(PCT pct) { PCT = pct; }
public void SpawnPlayers(PCT one, PCT two) { string objName = ""; switch (one) { case PCT.NONE: { objName = "Evan"; } break; case PCT.MATEO: { objName = "Mateo"; } break; case PCT.EVAN: { objName = "Evan"; } break; case PCT.WILLEN: { objName = "Mateo"; } break; case PCT.NOAH: { objName = "Mateo"; } break; case PCT.BRENDAN: { objName = "Mateo"; } break; case PCT.CAMERON: { objName = "Mateo"; } break; case PCT.IAN: { objName = "Mateo"; } break; case PCT.RANDOM: { objName = "Mateo"; } break; } GameObject obj = Instantiate(Resources.Load(objName, typeof(GameObject)) as GameObject);; obj.transform.position = this.transform.position; this.GetComponent <MeshRenderer>().enabled = false; pOne = obj.GetComponent <CharacterControl>(); d.GetComponent <UIDamageText>().dd = pOne; s.GetComponent <UIStocksText>().cc = pOne; //s.GetComponent<UIStocksText>().dd = obj.GetComponent<DamageDetector>(); GameObject.Find("Targetgroup").GetComponent <CinemachineTargetGroup>().AddMember(obj.transform, 1, 0); obj.GetComponentInChildren <FollowPlayer>().uiArrow = GameObject.Find("Image GREEN").GetComponent <Image>(); obj.GetComponent <ManualInput>().enabled = true; obj.GetComponent <ManualInputTwo>().enabled = false; }