void Update( ) { //if player hit use button set the tile behind it also reset paintball color if (manager != null && Input.GetButtonDown(parent.NumPlayer + "Paintball") && Parent.IsPlayerOnGround) { Parent.State = "PAINTBALL_USING"; manager.SetTile(paintballColor, transform.position); Parent.StopAction(stopActionTime); ResetPaintball( ); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Ground") { bPenetrate = (Random.Range(0, 2) % 2 == 0)?true:false; if (!bPenetrate) { manager.SetTile(paintballColor, transform.position); } } }
protected override void OnTriggerEnter2D(Collider2D other) { base.OnTriggerEnter2D(other); //if bombstate is WAITING and other player enter the area find 10 random position and color then try to set tiles if (bombState == ART_BOMB_STATE.WAITING && other.tag == "Player" && other.GetComponent <IPlayer> ( ) != Owner) { for (int i = 0; i < 10; i++) { Vector3 pos = new Vector3(transform.position.x + Random.Range(-posOffset.x, posOffset.x), transform.position.y + Random.Range(-posOffset.y, posOffset.y), transform.position.z); EColor paintballColor = (EColor)Random.Range(0, System.Enum.GetValues(typeof(EColor)).Length - 1); tilemapManager.SetTile(paintballColor, pos); } bombState = ART_BOMB_STATE.BOMBING; } }