コード例 #1
0
    void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (sb == null)
        {
            sb = GetComponent <StickyBomb> ();
        }

        if (sb.isStuck)
        {
            return;
        }

        if (stream.isWriting)
        {
            // We own this player: send the others our data
            stream.SendNext(transform.position);
            stream.SendNext(transform.rotation);
        }
        else
        {
            // Network player, receive data
            this.correctBombPos = (Vector3)stream.ReceiveNext();
            this.correctBombRot = (Quaternion)stream.ReceiveNext();
        }
    }
コード例 #2
0
    void GetStuck(Vector3 stuckPos, Vector3 scale, int stickyID)
    {
        Debug.Log("Got stuck");
        isStuck       = true;
        stuckPosition = stuckPos;

        StickyBomb[] stickys   = GameObject.FindObjectsOfType <StickyBomb> ();
        StickyBomb   theSticky = null;

        foreach (var s in stickys)
        {
            if (s.GetComponent <PhotonView>().viewID == stickyID)
            {
                theSticky = s;
                break;
            }
        }

        if (theSticky != null)
        {
            AudioSource.PlayClipAtPoint(getStuck, GameObject.FindObjectOfType <GameCamera>().transform.position);
            currentStuck = theSticky.GetComponent <StickyBomb>();
            theSticky.transform.SetParent(this.transform);
            theSticky.transform.localScale = scale * 9;
            theSticky.transform.position   = stuckPos;
            theSticky.GetComponent <Rigidbody2D>().isKinematic = true;
            theSticky.isStuck = true;
            theSticky.GetComponent <StickyBomb>().stuckID = playerID;
            PopText.Create("STUCK!", Color.white, 120, this.transform.position + Vector3.up * .5f);
            Debug.Log("Current stuck: " + currentStuck.name);
        }
    }
コード例 #3
0
        public void Setup()
        {
            if (setup)
            {
                return;
            }
            try
            {
                Tools.Init();
                ItemBuilder.Init();

                //Phase 1
                BloodBank.Init();
                BloodShield.Init();
                BossBullets.Init();
                ChestReroller.Init();
                CursedRing.Init();
                HologramItem.Init();
                IcePack.Init();
                LightningGuon.Init();
                MimicWhistle.Init();
                ScrollOfApproxKnowledge.Init();
                SlotMachine.Init();
                SweatingBullets.Init();
                TerrifyingMask.Init();

                //Phase 2
                BabyGoodBlob.Init();
                CloakAndDagger.Init();
                Drone.Init();
                MagicMirror.Init();
                Pikachu.Init();
                RubyLotus.Init();
                StickyBomb.Init();
                Thermometer.Init();
                NinjaMask.Init();

                //Phase 3
                Leveler.Init();
                BigSlime.Init();

                setup = true;
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
            }


            ETGModConsole.Commands.AddUnit("kts", e =>
            {
                ETGModConsole.Log("Custom Items: ");
                foreach (string s in itemList)
                {
                    ETGModConsole.Log("    " + s);
                }
            });

            ETGModConsole.Log($"KTS Item Pack {version} Initialized");
        }
コード例 #4
0
    public void LOCAL_SwitchOwners(Vector3 stuckPos, Vector3 scale, StickyBomb theSticky)
    {
        isStuck       = true;
        stuckPosition = stuckPos;

        if (theSticky != null)
        {
            currentStuck = theSticky.GetComponent <StickyBomb>();
            theSticky.transform.SetParent(this.transform);
            theSticky.transform.position = stuckPos;
            theSticky.GetComponent <Rigidbody2D>().isKinematic = true;
            theSticky.isStuck = true;
            //the person that ran into you is now the potential killer
            theSticky.GetComponent <StickyBomb>().ownerID = theSticky.GetComponent <StickyBomb>().stuckID;
            theSticky.GetComponent <StickyBomb>().stuckID = playerID;
            theSticky.GetComponent <LocalStickyBomb>().TransferBomb();
            PopText.Create("STUCK!", Color.white, 120, this.transform.position + Vector3.up * .5f);
            //get the new owner and tell him he isnt stuck anymore
            AudioSource.PlayClipAtPoint(transferBomb, GameObject.FindObjectOfType <GameCamera>().transform.position);
            PlayerController   newOwner = null;
            PlayerController[] players  = GameObject.FindObjectsOfType <PlayerController>();

            foreach (var p in players)
            {
                if (p.playerID == theSticky.ownerID)
                {
                    newOwner = p;
                }
            }

            newOwner.isStuck      = false;
            newOwner.currentStuck = null;
        }
        GameObject.Find("Main Camera").GetComponent <GameCamera> ().BombStuck();
    }
コード例 #5
0
    public void LOCAL_GetStuck(Vector3 stuckPos, Vector3 scale, StickyBomb theSticky)
    {
        isStuck       = true;
        stuckPosition = stuckPos;

        if (theSticky != null)
        {
            if (!isPaused)
            {
                theSticky.GetComponent <LocalStickyBomb> ().gamePaused = false;
                AudioSource.PlayClipAtPoint(getStuck, GameObject.FindObjectOfType <GameCamera> ().transform.position);
                currentStuck = theSticky.GetComponent <StickyBomb> ();
                theSticky.transform.SetParent(this.transform);
                theSticky.transform.localScale = scale * 9;
                theSticky.transform.position   = stuckPos;
                theSticky.GetComponent <Rigidbody2D> ().isKinematic = true;
                theSticky.isStuck = true;
                theSticky.GetComponent <LocalStickyBomb> ().TransferBomb();
                theSticky.GetComponent <StickyBomb> ().stuckID = playerID;
                PopText.Create("STUCK!", Color.white, 120, this.transform.position + Vector3.up * .5f);
                Debug.Log("Current stuck: " + currentStuck.name);
            }
            else
            {
                theSticky.GetComponent <LocalStickyBomb> ().gamePaused = true;
            }
        }
    }
コード例 #6
0
    void LocalLogic(Collider2D c)
    {
        PlayerController pc = this.transform.root.GetComponent <PlayerController>();
        StickyBomb       sb = c.gameObject.GetComponent <StickyBomb>();

        Debug.Log("Sticky : " + sb.ownerID + ", Owner: " + pc.playerID);

        if (sb.hitGround)
        {
            PopText.Create("Get Bomb!", Color.black, 60, sb.transform.position + Vector3.up);
            Vector3 scale = new Vector3(c.gameObject.transform.localScale.x, c.gameObject.transform.localScale.y, c.gameObject.transform.localScale.z);
            pc.LOCAL_PickupBombGround(sb);
        }
        else
        {
            if (!pc.playerID.Equals(sb.ownerID) && !sb.isStuck)
            {
                Debug.Log("Sucess!");
                Vector3 scale = new Vector3(c.gameObject.transform.localScale.x, c.gameObject.transform.localScale.y, c.gameObject.transform.localScale.z);
                pc.LOCAL_GetStuck(sb.transform.position, scale, sb);
            }

            //for switching owners
            else if (sb.isStuck && !sb.GetComponent <LocalStickyBomb>().justTransfered&&
                     !pc.playerID.Equals(sb.stuckID))
            {
                Debug.Log("Sucess!");
                Vector3 scale = new Vector3(c.gameObject.transform.localScale.x, c.gameObject.transform.localScale.y, c.gameObject.transform.localScale.z);
                //this transform, scale, stickyID
                pc.LOCAL_SwitchOwners(sb.transform.position, scale, sb);
                sb.GetComponent <LocalStickyBomb>().TransferBomb();
            }
        }
    }
コード例 #7
0
 protected override void OnOwnerHitEnemy(Character character, float pre_damage, float post_damage, Character hit)
 {
     if (rng.GetFloat() < (chance_per_hit / 2f + (chance_per_hit / 2f * item.stack_count)))
     {
         StickyBomb new_bomb = Instantiate(bomb);
         new_bomb.BeginBomb(character, hit, OnBombHit);
     }
 }
コード例 #8
0
 public void LOCAL_PickupBombGround(StickyBomb theSticky)
 {
     //pickup the bomb, and destroy the bomb
     hasStickyBomb = true;
     bombStatus.GetComponent <SpriteRenderer>().sprite = hasBombSprite;
     AudioSource.PlayClipAtPoint(pickupBomb, GameObject.FindObjectOfType <GameCamera>().transform.position);
     GameObject.Destroy(theSticky.gameObject);
 }
コード例 #9
0
    void SetBomb(int stickyID, string pName)
    {
        StickyBomb[] stickys   = GameObject.FindObjectsOfType <StickyBomb> ();
        StickyBomb   theSticky = null;

        foreach (var s in stickys)
        {
            if (s.GetComponent <PhotonView>().viewID == stickyID)
            {
                theSticky = s;
                break;
            }
        }
        theSticky.GetComponent <StickyBomb>().ownerID = playerID;
    }
コード例 #10
0
    // Update is called once per frame
    void Update()
    {
        if (sb == null)
        {
            sb = GetComponent <StickyBomb> ();
        }
        if (sb.isStuck)
        {
            return;
        }

        if (!photonView.isMine)
        {
            transform.position = Vector3.Lerp(transform.position, this.correctBombPos, Time.deltaTime * 20);
            transform.rotation = Quaternion.Lerp(transform.rotation, this.correctBombRot, Time.deltaTime * 20);
        }
    }
コード例 #11
0
    void NetworkedLogic(Collider2D c)
    {
        PlayerController pc = this.transform.root.GetComponent <PlayerController>();
        StickyBomb       sb = c.gameObject.GetComponent <StickyBomb>();

        Debug.Log("Sticky : " + sb.ownerID + ", Owner: " + pc.playerID);

        if (sb.hitGround)
        {
            PopText.Create("Get Bomb!", Color.black, 60, sb.transform.position + Vector3.up);
            Vector3 scale = new Vector3(c.gameObject.transform.localScale.x, c.gameObject.transform.localScale.y, c.gameObject.transform.localScale.z);
            //this transform, scale, stickyID
            pc.GetComponent <PhotonView> ().RPC("PickupBombGround", PhotonTargets.All, sb.transform.position, scale, sb.GetComponent <PhotonView>().viewID);
        }
        else
        {
            if (!pc.playerID.Equals(sb.ownerID) && !sb.isStuck)
            {
                Debug.Log("Sucess!");
                Vector3 scale = new Vector3(c.gameObject.transform.localScale.x, c.gameObject.transform.localScale.y, c.gameObject.transform.localScale.z);
                //this transform, scale, stickyID
                pc.GetComponent <PhotonView> ().RPC("GetStuck", PhotonTargets.All, sb.transform.position, scale, sb.GetComponent <PhotonView>().viewID);
            }

            //for switching owners
            else if (sb.isStuck && !sb.GetComponent <NetworkStickyBomb>().justTransfered&&
                     !pc.playerID.Equals(sb.stuckID))
            {
                Debug.Log("Sucess!");
                Vector3 scale = new Vector3(c.gameObject.transform.localScale.x, c.gameObject.transform.localScale.y, c.gameObject.transform.localScale.z);
                //this transform, scale, stickyID
                pc.GetComponent <PhotonView> ().RPC("SwitchOwners", PhotonTargets.All, sb.transform.position, sb.GetComponent <PhotonView>().viewID);

                //call first on master client so transfer doesnt occur multiple times
                sb.GetComponent <NetworkStickyBomb>().TransferBomb();
            }
        }
    }
コード例 #12
0
    void PickupBombGround(Vector3 stuckPos, Vector3 scale, int stickyID)
    {
        StickyBomb[] stickys   = GameObject.FindObjectsOfType <StickyBomb> ();
        StickyBomb   theSticky = null;

        foreach (var s in stickys)
        {
            if (s.GetComponent <PhotonView>().viewID == stickyID)
            {
                theSticky = s;
                break;
            }
        }

        if (theSticky != null)
        {
            AudioSource.PlayClipAtPoint(pickupBomb, GameObject.FindObjectOfType <GameCamera>().transform.position);
            //pickup the bomb, and destroy the bomb
            hasStickyBomb = true;
            bombStatus.GetComponent <SpriteRenderer>().sprite = hasBombSprite;
            PhotonNetwork.Destroy(theSticky.gameObject);
        }
    }
コード例 #13
0
    void FixedUpdate()
    {
        if (PhotonNetwork.isMasterClient)
        {
            if (sb == null)
            {
                sb = GetComponent <StickyBomb> ();
            }

            if (sb.isStuck)
            {
                countdownTimer--;

                if (countdownTimer % 60 == 0)
                {
                    GetComponent <PhotonView>().RPC("DisplayCountdown", PhotonTargets.All, countdownTimer / 60);
                }

                if (countdownTimer == 0)
                {
                    GetComponent <PhotonView>().RPC("Blowup", PhotonTargets.All);
                    PhotonNetwork.Destroy(this.gameObject);

                    PlayerController   stuckPlayer   = null;
                    PlayerController   gotKillPlayer = null;
                    PlayerController[] players       = GameObject.FindObjectsOfType <PlayerController>();

                    foreach (var p in players)
                    {
                        if (p.playerID == sb.stuckID)
                        {
                            stuckPlayer = p;
                        }
                        if (p.playerID == sb.ownerID)
                        {
                            gotKillPlayer = p;
                        }
                    }

                    if (stuckPlayer.GetComponent <BigBoy>() != null &&
                        !stuckPlayer.GetComponent <BigBoy>().alreadyHit)
                    {
                        //take away a life but dont kill him
                        GetComponent <PhotonView>().RPC("BigBoyHit", PhotonTargets.All, stuckPlayer.playerID, gotKillPlayer.playerID);
                    }
                    else
                    {
                        GetComponent <PhotonView>().RPC("DisplayKill", PhotonTargets.All, stuckPlayer.playerID, gotKillPlayer.playerID);
                    }

                    //check to see if we should spawn a crate
                    players = GameObject.FindObjectsOfType <PlayerController>();
                    if (players.Length == 1)
                    {
                        //dont spawn crate
                    }
                    else
                    {
                        //spawn crate
                        //spawn a crate if we are master
                        GameObject crate = PhotonNetwork.Instantiate("StickyCrate",
                                                                     GameObject.FindObjectOfType <GameCamera>().GetRandomSpawnPoint(), Quaternion.identity, 0);
                    }
                }

                if (justTransfered)
                {
                    justTransferedTimer--;

                    if (justTransferedTimer == 0)
                    {
                        justTransfered = false;
                    }
                }
            }
            else if (sb.hitGround)
            {
                groundedTimer--;

                if (groundedTimer % 60 == 0)
                {
                    GetComponent <PhotonView>().RPC("DisplayCountdown", PhotonTargets.All, groundedTimer / 60);
                }

                if (groundedTimer <= 180 && groundedTimer % 30 == 0)
                {
                    GetComponent <PhotonView>().RPC("Bursting", PhotonTargets.All, bursting);
                    bursting = !bursting;
                }

                if (groundedTimer == 0)
                {
                    GetComponent <PhotonView>().RPC("Blowup", PhotonTargets.All);

                    PlayerController   stuckPlayer   = null;
                    PlayerController   gotKillPlayer = null;
                    PlayerController[] players       = GameObject.FindObjectsOfType <PlayerController>();

                    foreach (var p in players)
                    {
                        if (p.playerID == sb.stuckID)
                        {
                            stuckPlayer = p;
                        }
                        if (p.playerID == sb.ownerID)
                        {
                            gotKillPlayer = p;
                        }
                    }

                    //TODO: stuck player doesnt exist...loop thru all players and calculate their positions to see if they are affected
                    //by the bomb

                    /*
                     * if(stuckPlayer.GetComponent<BigBoy>() != null &&
                     * !stuckPlayer.GetComponent<BigBoy>().alreadyHit)
                     * {
                     *      //take away a life but dont kill him
                     *      GetComponent<PhotonView>().RPC("BigBoyHit", PhotonTargets.All, stuckPlayer.playerID, gotKillPlayer.playerID);
                     * }
                     * else
                     * {
                     *      GetComponent<PhotonView>().RPC("DisplayKill", PhotonTargets.All, stuckPlayer.playerID, gotKillPlayer.playerID);
                     * }*/
                    int[] hits = new int[] { -1, -1, -1, -1 };
                    int[] pID  = new int[] { -1, -1, -1, -1 };
                    for (int i = 0; i < players.Length; ++i)
                    {
                        PlayerController p = players[i];
                        //pID[i] = p.playerID;
                        if (Vector3.Distance(this.transform.position, p.transform.position) < 1.8f)
                        {
                            hits[i] = p.playerID;
                        }
                    }

                    GetComponent <PhotonView>().RPC("DisplayKillGround", PhotonTargets.All, gotKillPlayer.playerID,
                                                    hits[0], hits[1], hits[2], hits[3]);

                    //check to see if we should spawn a crate
                    players = GameObject.FindObjectsOfType <PlayerController>();
                    if (players.Length == 1 && PhotonNetwork.room.playerCount != 1)
                    {
                        //dont spawn crate
                    }
                    else
                    {
                        GameObject crate = PhotonNetwork.Instantiate("StickyCrate",
                                                                     GameObject.FindObjectOfType <GameCamera>().GetRandomSpawnPoint(), Quaternion.identity, 0);
                    }
                }
            }
        }
    }
コード例 #14
0
 void Start()
 {
     sb = GetComponent <StickyBomb> ();
 }
コード例 #15
0
    void FixedUpdate()
    {
        if (!gamePaused)
        {
            PlayerController[] players = GameObject.FindObjectsOfType <PlayerController> ();
            for (int i = 0; i < players.Length; i++)
            {
                if (players [i].isPaused)
                {
                    gamePaused = true;
                }
            }
            if (sb == null)
            {
                sb = GetComponent <StickyBomb> ();
            }

            if (sb.isStuck)
            {
                PopText.Create("o", Color.cyan, 30, this.transform.position);
                countdownTimer--;

                if (countdownTimer % 60 == 0)
                {
                    LOCAL_DisplayCountdown(countdownTimer / 60);
                }

                if (countdownTimer == 0)
                {
                    bool lastBomb = true;

                    StickyBomb[] allStickys = GameObject.FindObjectsOfType <StickyBomb> ();
                    if (allStickys.Length > 1)
                    {
                        lastBomb = false;
                    }
                    if (PlayerController.SomeoneHasSticky())
                    {
                        lastBomb = false;
                    }

                    Blowup();
                    GameObject.Destroy(this.gameObject);

                    PlayerController stuckPlayer   = null;
                    PlayerController gotKillPlayer = null;

                    foreach (var p in players)
                    {
                        if (p.playerID == sb.stuckID)
                        {
                            stuckPlayer = p;
                        }
                        if (p.playerID == sb.ownerID)
                        {
                            gotKillPlayer = p;
                        }
                    }

                    if (stuckPlayer.GetComponent <BigBoy> () != null &&
                        !stuckPlayer.GetComponent <BigBoy> ().alreadyHit)
                    {
                        //take away a life but dont kill him
                        BigBoyHit(stuckPlayer.playerID, gotKillPlayer.playerID);
                    }
                    else
                    {
                        if (stuckPlayer != null && gotKillPlayer != null)
                        {
                            DisplayKill(stuckPlayer.playerID, gotKillPlayer.playerID);
                        }
                    }

                    //check to see if we should spawn a crate
                    players = GameObject.FindObjectsOfType <PlayerController> ();
                    if (players.Length == 1)
                    {
                        //dont spawn crate
                        Debug.Log("DIDNT SPAWN CRATE BECAUSE ONLY ONE PLAYER!");
                    }
                    else if (lastBomb)
                    {
                        //spawn crate
                        GameObject crate = (GameObject)GameObject.Instantiate(localCratePrefab,
                                                                              GameObject.FindObjectOfType <GameCamera> ().GetRandomSpawnPoint(), Quaternion.identity);
                    }

                    GameObject.FindObjectOfType <GameCamera> ().UpdateStatsLocal();
                }

                if (justTransfered)
                {
                    justTransferedTimer--;

                    if (justTransferedTimer == 0)
                    {
                        justTransfered = false;
                    }
                }
            }
            else if (sb.hitGround)
            {
                groundedTimer--;

                if (groundedTimer % 60 == 0)
                {
                    LOCAL_DisplayCountdown(groundedTimer / 60);
                }

                if (groundedTimer <= 180 && groundedTimer % 30 == 0)
                {
                    Bursting(bursting);
                    bursting = !bursting;
                }

                if (groundedTimer == 0)
                {
                    bool lastBomb = true;

                    StickyBomb[] allStickys = GameObject.FindObjectsOfType <StickyBomb> ();
                    if (allStickys.Length > 1)
                    {
                        lastBomb = false;
                    }
                    if (PlayerController.SomeoneHasSticky())
                    {
                        lastBomb = false;
                    }

                    Blowup();

                    PlayerController stuckPlayer   = null;
                    PlayerController gotKillPlayer = null;

                    foreach (var p in players)
                    {
                        if (p.playerID == sb.stuckID)
                        {
                            stuckPlayer = p;
                        }
                        if (p.playerID == sb.ownerID)
                        {
                            gotKillPlayer = p;
                        }
                    }

                    int[] hits = new int[] { -1, -1, -1, -1 };
                    int[] pID  = new int[] { -1, -1, -1, -1 };
                    for (int i = 0; i < players.Length; ++i)
                    {
                        PlayerController p = players [i];
                        //pID[i] = p.playerID;
                        if (Vector3.Distance(this.transform.position, p.transform.position) < 1.8f)
                        {
                            hits [i] = p.playerID;
                        }
                    }

                    if (gotKillPlayer != null)
                    {
                        DisplayKillGround(gotKillPlayer.playerID,
                                          hits [0], hits [1], hits [2], hits [3]);
                    }

                    //check to see if we should spawn a crate
                    players = GameObject.FindObjectsOfType <PlayerController> ();
                    if (players.Length == 1)
                    {
                        //dont spawn crate, round is over
                    }
                    else if (lastBomb)                    //only spawn a crate if all the bombs are gone (there might be a scientist on the map)
                    {
                        GameObject crate = (GameObject)GameObject.Instantiate(localCratePrefab,
                                                                              GameObject.FindObjectOfType <GameCamera> ().GetRandomSpawnPoint(), Quaternion.identity);
                    }
                }
            }
            else if (!sb.hitGround)
            {
                PopText.Create("o", Color.cyan, 30, this.transform.position);
            }
        }

        else
        {
            GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
            for (int i = 0; i < players.Length; i++)
            {
                if (players [i].GetComponent <PlayerController> ().isPaused)
                {
                    gamePaused = false;
                }
            }
        }
    }
コード例 #16
0
    public void COMMAND_LocalThrowBomb()
    {
        if (!XBox.StartPressed())
        {
            //throw bomb
            //WAIT if you are the scientist, let us throw two instead!
            if (GetComponent <Scientist> () != null && abs.ability_ready)
            {
                //throw bomb
                hasStickyBomb = false;
                bombStatus.GetComponent <SpriteRenderer> ().sprite = noBombSprite;

                if (abs.ability_ready)
                {
                    GetComponent <Scientist> ().bombsThrown = true;
                }
                abs.ability_ready = false;
                abs.UpdateReady();
                animator.SetTrigger("Throw");
                //>>>>>>> 9d7014c9d9c7ae46f9e434202e06ac007b80b210:A Sticky Situation/Assets/Engine/Player/PlayerController.cs

                GameObject localStickyPrefab = Resources.Load <GameObject> ("LocalStickyBomb");
                GameObject theBomb           = (GameObject)GameObject.Instantiate(localStickyPrefab, this.transform.position, Quaternion.identity);
                StickyBomb sb = theBomb.GetComponent <StickyBomb> ();
                sb.ownerID = playerID;
                AudioSource.PlayClipAtPoint(threwBomb, GameObject.FindObjectOfType <GameCamera> ().transform.position);
                GameObject.Destroy(GameObject.Instantiate(specialParticleEffect, this.transform.position, Quaternion.identity), 5f);

                if (transform.localScale.x > 0)
                {
                    //throw to right
                    theBomb.GetComponent <Rigidbody2D> ().AddForce(new Vector2(600, -75));
                }
                else
                {
                    theBomb.GetComponent <Rigidbody2D> ().AddForce(new Vector2(-600, -75));
                }

                //throw another
                GameObject secondBomb = (GameObject)GameObject.Instantiate(localStickyPrefab, this.transform.position, Quaternion.identity);
                StickyBomb sb2        = secondBomb.GetComponent <StickyBomb> ();
                sb2.ownerID = playerID;

                if (transform.localScale.x > 0)
                {
                    //throw to right
                    secondBomb.GetComponent <Rigidbody2D> ().AddForce(new Vector2(600, 75));
                }
                else
                {
                    secondBomb.GetComponent <Rigidbody2D> ().AddForce(new Vector2(-600, 75));
                }
            }
            else
            {
                //throw bomb
                hasStickyBomb = false;
                bombStatus.GetComponent <SpriteRenderer> ().sprite = noBombSprite;
                GameObject localStickyPrefab = Resources.Load <GameObject>("LocalStickyBomb");
                GameObject theBomb           = (GameObject)GameObject.Instantiate(localStickyPrefab, this.transform.position, Quaternion.identity);
                StickyBomb sb = theBomb.GetComponent <StickyBomb>();
                sb.ownerID = playerID;
                AudioSource.PlayClipAtPoint(threwBomb, GameObject.FindObjectOfType <GameCamera>().transform.position);
                animator.SetTrigger("Throw");

                if (transform.localScale.x > 0)
                {
                    //throw to right
                    theBomb.GetComponent <Rigidbody2D> ().AddForce(new Vector2(600, -50));
                }
                else
                {
                    theBomb.GetComponent <Rigidbody2D> ().AddForce(new Vector2(-600, -50));
                }
            }
        }
    }