//public void fireProps(int carID){} public void launchBomb(Vector3 startPos, int target) { GameObject obj = Instantiate(bomb, startPos, Quaternion.identity) as GameObject; bomb b = obj.GetComponent <bomb> (); b.setTargetCar(target); }
void OnTriggerStay2D(Collider2D collider) { if (collider.gameObject.layer != LayerMask.NameToLayer(bombLayer)) { return; } defuseInstructions.SetActive(true); if (Input.GetAxisRaw("Defuse") == 1) { if (currentBomb == null) { currentBomb = collider.GetComponent <bomb>(); sliderPanel.SetActive(true); defuzeSlider.maxValue = currentBomb.maxDefusePoints; } if (collider.GetComponent <bomb>() != currentBomb) { return; } currentBomb.isBeingDefused = true; } else { if (collider.GetComponent <bomb>() != currentBomb) { return; } currentBomb.isBeingDefused = false; } }
void _MakeInstance() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { StatusPlayer = GetComponent <PlayerStats>(); bombie = bomb.GetComponent("bomb") as bomb; sprites = Resources.LoadAll <Sprite>(texture.name); }
private void start_the_game() { Int32.TryParse(textBox1.Text, out wc); hc = wc; w = ww / wc; h = hw / hc; dots = new dot[wc, hc]; Random rand = new Random(69); for (int x = 0; x < wc; x++) { for (int y = 0; y < hc; y++) { int n = rand.Next(0, 100); if (n < fullness) { dots[x, y] = new bomb(); } else { dots[x, y] = new empty(); } } } for (int x = 0; x < wc; x++) { for (int y = 0; y < hc; y++) { if (dots[x, y].tp != type.bomb) { int count = 0; for (int x1 = -1; x1 <= 1; x1++) { for (int y1 = -1; y1 <= 1; y1++) { if (x + x1 < 0 || y + y1 < 0 || y + y1 >= hc || x + x1 >= wc) { continue; } if (dots[x + x1, y + y1].tp == type.bomb) { count++; } } } if (count == 0) { dots[x, y] = new empty(); } else { dots[x, y] = new num(count); } } } } this.Controls.Clear(); form = state.game; Invalidate(); }
void Update() { if (Fire == true) { GameObject go = (GameObject)Instantiate(TAMA, this.transform.position, Quaternion.identity); bomb bom = go.GetComponent <bomb>(); bom.GameObject = this.gameObject; Fire = false; } }
public bomb currentBomb; //All logic involving this was implemented to prevent bugs if the player ends up in two bomb colliders at the same tine void OnTriggerExit2D(Collider2D collider) { if (collider.gameObject.layer != LayerMask.NameToLayer(bombLayer)) { return; } defuseInstructions.SetActive(false); if (currentBomb != null) { currentBomb.isBeingDefused = false; currentBomb = null; } }
void CirBomb() { float angle2 = 7; float power = 5; angle -= angle2; clone = Instantiate(bomb, transform.position, Quaternion.identity); bomb.dir = new Vector3(power * Mathf.Cos(Rad(angle)), 0, power * Mathf.Sin(Rad(angle))); if (angle <= 90 - 360) { Destroy(gameObject); } }
void RndBomb() { for (int i = 0; i < 10; i++) { float degree = Random.Range(0, 360); float power = Random.Range(2, 6); clone = Instantiate(bomb, transform.position, Quaternion.identity); bomb.dir = new Vector3(power * Mathf.Cos(Rad(degree)), 0, power * Mathf.Sin(Rad(degree))); } if (x == z) { Destroy(gameObject); } }
void OnTriggerStay(Collider other) { GameObject target = other.gameObject; move playerScript = Player.GetComponent <move>(); health enemyScript = target.GetComponent <health>(); bomb itemScript = target.GetComponent <bomb>(); if (enemyScript != null) { if (other.name != "Paladin(Clone)") { if (!(enemyScript.invincibilityFrames > 0)) { enemyScript.HP -= damage; enemyScript.invincibilityFrames = .75f; } } else {//fighting a paladin //Debug.Log("player " + playerScript.direction + ", paladin " + enemyScript.direction + " health remaining " + enemyScript.HP); if ((playerScript.direction + 2) % 4 != enemyScript.direction % 4) { if (!(enemyScript.invincibilityFrames > 0)) { enemyScript.HP -= damage; enemyScript.invincibilityFrames = .75f; } } //else //Debug.Log("shield block"); } } else if (itemScript != null)//hitting a bomb { itemScript.direction = playerScript.direction; //itemScript.standing = false; itemScript.moveSpaces = 2; } }
void OnTriggerStay(Collider other) { GameObject target = other.gameObject; if (Character.name == "Player") { if (target.name == "wall") { move playerScript = Character.GetComponent <move>(); if (side == 1) { playerScript.northFree = false; } if (side == 2) { playerScript.eastFree = false; } if (side == 3) { playerScript.southFree = false; } if (side == 4) { playerScript.westFree = false; } } } else//Character.name != player (i.e. this is an enemy) { if (target.name == "wall" || target.name == "invisableFence") { wander enemyScript = Character.GetComponent <wander>(); if (enemyScript != null) { //Debug.Log("hitting the wall"); if (side == 1) { enemyScript.northFree = false; } if (side == 2) { enemyScript.eastFree = false; } if (side == 3) { enemyScript.southFree = false; } if (side == 4) { enemyScript.westFree = false; } } bomb itemScript = Character.GetComponent <bomb>(); if (itemScript != null) { if (side == 1) { itemScript.northFree = false; } if (side == 2) { itemScript.eastFree = false; } if (side == 3) { itemScript.southFree = false; } if (side == 4) { itemScript.westFree = false; } } toAndFro bounce = Character.GetComponent <toAndFro>(); if (bounce != null) { if (side == 2) { bounce.wallOnRight = true; } if (side == 4) { bounce.wallOnLeft = true; } } } } }