Exemple #1
0
    public void SetupStart()
    {
        isTaken        = false;
        isInBase       = true;
        player         = null;
        rigid          = GetComponent <Rigidbody2D>();
        rigid.bodyType = RigidbodyType2D.Static;

        if (!teamBase)
        {
            GameObject initBase = null;
            if (team == LobbyPlayer.PlayerTeam.RED)
            {
                initBase = GameObject.FindGameObjectWithTag("RedBase");
            }
            else
            {
                initBase = GameObject.FindGameObjectWithTag("BlueBase");
            }

            if (!initBase != null)
            {
                teamBase = initBase.transform.Find("FlagBase");
            }
        }

        if (teamBase)
        {
            transform.position = teamBase.position;
        }
        timerRefreshNetwork = Utility.StartTimer(timeRefreshPosEvery);
    }
Exemple #2
0
    private void OnShowCombatResults(object data)
    {
        _ResultsText.enabled = true;

        int[] combatData = (int[])data;
        int   winner     = combatData[2];

        if (winner == 0)
        {
            _ResultsText.text = "Tie";
            return;
        }
        else if (winner == -1)
        {
            _ResultsText.text = "You ran out of time!";
        }

        LocalPlayerController winnerPlayer = PhotonView.Find(winner).GetComponent <LocalPlayerController>();

        if (winnerPlayer == null)
        {
            _ResultsText.text = "You Lose";
            return;
        }
        _ResultsText.text = "You Win";
    }
Exemple #3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Shot")
     {
         ShotDestroyerScript SDS = other.gameObject.GetComponent <ShotDestroyerScript>();
         if (!SDS.IsUsed)
         {
             if (MyLCP.hasShield)
             {
                 LocalPlayerController LPC = gameObject.GetComponentInParent <LocalPlayerController>();
                 Instantiate(shieldExplosion, LPC.mesh.transform.position, new Quaternion());
                 LPC.DisableShield();
                 Destroy(other.transform.root.gameObject);
             }
             else
             {
                 SDS.IsUsed = true;
                 Debug.Log("PLAYER HIT");
                 MyLCP.DestroyObject();
             }
             //explosionInstance.transform.SetParent(transform);
         }
     }
     else if (other.gameObject.tag == "Boundary" || other.gameObject.tag == "PiercingShot" || other.gameObject.tag == "StarPulse")
     {
         MyLCP.DestroyObject();
     }
 }
Exemple #4
0
    public void UpdateInput(ref GameInput input, LocalPlayerController controller)
    {
        stratgyTimer -= Time.deltaTime;
        if (stratgyTimer < 0f)
        {
            stratgyTimer = UnityEngine.Random.Range(2f, 5f);
            if (stratgy == Strategy.Defense)
            {
                stratgy = Strategy.Attack;
            }
            else
            {
                stratgy = Strategy.Defense;
            }
        }

        Player target = FindTarge();

        if (target != null)
        {
            switch (stratgy)
            {
            case Strategy.Attack:
                AttackStrategy(ref input, controller, target);
                break;

            case Strategy.Defense:
                DefenseStrategy(ref input, controller, target);
                break;
            }
        }
    }
Exemple #5
0
    void DefenseStrategy(ref GameInput input, LocalPlayerController controller, Player target)
    {
        player.targetId = target.id;
        Vector3 diffPos = target.transform.position - controller.transform.position;
        float   yaw     = CommonHelper.YawOfVector3(diffPos);

        if (diffPos.magnitude < 4f)
        {
            input.moveYaw = yaw + 180f;
            input.roll    = true;
        }
        else
        {
            strafeDirTimer -= Time.deltaTime;
            if (strafeDirTimer < 0)
            {
                strafeDirTimer = UnityEngine.Random.Range(1f, 2f);
                strafeRight    = !strafeRight;
            }
            input.offHand = true;
            input.hasMove = true;
            if (strafeRight)
            {
                input.moveYaw = yaw - 80f;
            }
            else
            {
                input.moveYaw = yaw + 80f;
            }
        }
    }
Exemple #6
0
    public override void Start(Player player, LocalPlayerController controller, System.Object param)
    {
        base.Start(player, controller, param);

        actionName = param as string;
        if (actionName == null)
        {
            actionName = "Attack1";
        }
        player.animator.updateMode      = AnimatorUpdateMode.AnimatePhysics;
        player.animator.applyRootMotion = true;
        if (actionName == "Attack2")
        {
            player.SetUpperAniState(Player.StateNameHash.attack2, true);
            player.SetLowerAniState(Player.StateNameHash.attack2, true);
        }
        else
        {
            player.SetUpperAniState(Player.StateNameHash.attack1, true);
            player.SetLowerAniState(Player.StateNameHash.attack1, true);
        }

        wc = player.weaponCollision;
        if (wc != null)
        {
            wc.onHit += this.OnWeaponHit;
        }

        hitList.Clear();
    }
Exemple #7
0
    void UpdateDebugText()
    {
        if (GameObject.Find("LocalPlayer") == null)
        {
            return;
        }
        mPlayerInfoText = "";
        mPlayerInfoText = mPlayerInfoText + "GameMode = " + GC.GetGameMode() + "\n\n";


        GameObject[] mLocalPlayers = GameObject.FindGameObjectsWithTag("Player");
        int          count1        = 0;

        foreach (GameObject p in mLocalPlayers)
        {
            count1++;
            LocalPlayerController mLocalPlayer = p.GetComponent <LocalPlayerController>();
            mPlayerInfoText  = mPlayerInfoText + "Player NetID = " + mLocalPlayer.GetNetID() + "\n";
            mPlayerInfoText  = mPlayerInfoText + "isLocalPlayer = " + mLocalPlayer.isLocalPlayer + "\n";
            mPlayerInfoText  = mPlayerInfoText + "isClient = " + mLocalPlayer.isClient + "\n";
            mPlayerInfoText  = mPlayerInfoText + "isServer = " + mLocalPlayer.isServer + "\n";
            mPlayerInfoText  = mPlayerInfoText + "hasAuthority = " + mLocalPlayer.hasAuthority + "\n\n";
            mPlayerInfo.text = mPlayerInfoText;
        }
        mPlayerInfo.text = mPlayerInfoText;
    }
Exemple #8
0
 virtual public void Start(Player player, LocalPlayerController controller, System.Object param)
 {
     this.player     = player;
     this.controller = controller;
     player.footIk   = false;
     player.shootIk  = false;
 }
    private void Awake()
    {
        interactable = gameObject.GetComponent <Interactable>();
        if (interactable == null)
        {
            interactable = gameObject.AddComponent <Interactable>() as Interactable;
        }
        interactable.holdTime = pickupTime;
        interactable.afterUse.AddListener(OnInteractComplete);

        if (!playerController)
        {
            playerController = GameObject.FindGameObjectWithTag("LocalPlayer").GetComponent <LocalPlayerController>();
        }
        //playerController = GameObject.Find("Character").GetComponent<LocalPlayerController>();

        objManager = GameObject.Find("Network").GetComponent <NetworkObjectManager>();



        rb             = GetComponent <Rigidbody>();
        rb.isKinematic = false;
        cd             = GetComponent <Collider>();
        cd.enabled     = true;
    }
Exemple #10
0
    public void RpcTakeFlag(short playerId)
    {
        // TODO : UPDATE LE FAIT DE POUVOIR CHOPPER LE PLAYER FACILEMENT
        LocalPlayerController[] listPlayers = GameObject.FindObjectsOfType <LocalPlayerController>();
        foreach (var pPlayer in listPlayers)
        {
            if (pPlayer.playerId == playerId)
            {
                player = pPlayer;
                break;
            }
        }

        if (!player)
        {
            return;
        }

        if (isInBase)
        {
            SoundManager._instance.PlaySound(SoundManager.SoundList.TAKE_FLAG);
            GameManager._instance.UpdateInfoText("The " + team + " flag has been taken !");
        }

        player.flag = this;
        isTaken     = true;
        isInBase    = false;
        ChangeBodyType(false);
    }
Exemple #11
0
    void Start()
    {
        s = this;

        switch (DataHandler.s.toChar(DataHandler.s.myPlayerInteger))
        {
        case DataHandler.p_blue:
            myEffect = GS.a.gfxs.selectEffects[1];
            break;

        case DataHandler.p_red:
            myEffect = GS.a.gfxs.selectEffects[2];
            break;

        case DataHandler.p_green:
            myEffect = GS.a.gfxs.selectEffects[3];
            break;

        case DataHandler.p_yellow:
            myEffect = GS.a.gfxs.selectEffects[4];
            break;

        default:
            myEffect = GS.a.gfxs.selectEffects[1];
            break;
        }

        canSelect = true;
    }
Exemple #12
0
    public override void Start(Player player, LocalPlayerController controller, System.Object param)
    {
        base.Start(player, controller, param);

        string actionName = param as string;

        if (actionName == null)
        {
            controller.IntoState(PlayerStateType.Move);
            return;
        }
        else if (actionName == "GetHitFront")
        {
            aniStateHash = Player.StateNameHash.getHitFront;
        }
        else if (actionName == "GetHitBack")
        {
            aniStateHash = Player.StateNameHash.getHitBack;
        }
        else if (actionName == "BlockGetHit")
        {
            aniStateHash = Player.StateNameHash.blockGetHit;
        }


        player.animator.updateMode      = AnimatorUpdateMode.AnimatePhysics;
        player.animator.applyRootMotion = true;

        player.SetUpperAniState(aniStateHash, true);
        player.SetLowerAniState(aniStateHash, true);
    }
Exemple #13
0
 void Awake()
 {
     SoundM         = FindObjectOfType <SoundManager>();
     CameShakeM     = FindObjectOfType <CamShakeManager>();
     rigidBody      = gameObject.GetComponent <Rigidbody2D>();
     MyLCP          = GetComponentInParent <LocalPlayerController>();
     MaxPlayerSpeed = MyLCP.WidthMultiplier * MyLCP.MaxHorizontalSpeed;
 }
Exemple #14
0
 public void Start(Player player, LocalPlayerController controller)
 {
     this.player = player;
     if (player)
     {
         EventManager.AddListener(EventId.PlayerDamage, player.id, this.OnDamage);
     }
 }
Exemple #15
0
 public override void Start(Player player, LocalPlayerController controller, System.Object param)
 {
     base.Start(player, controller, param);
     inAirTime           = 0;
     targetStrafeForward = 0f;
     targetStrafeRight   = 0f;
     upperAction         = UpperAction.Empty;
 }
Exemple #16
0
    public override void Start(Player player, LocalPlayerController controller, System.Object param)
    {
        base.Start(player, controller, param);
        player.SetUpperAniState(Player.StateNameHash.jump, true);  //设置动画
        player.SetLowerAniState(Player.StateNameHash.jump, true);  //设置动画

        upForceCount = 5;
    }
Exemple #17
0
        public GameMenu(long?enemyPlayer = null)
        {
            this.isMultiplayerGame = enemyPlayer.HasValue;
            if (this.isMultiplayerGame)
            {
                this.enemyPlayerId = enemyPlayer.Value;
            }
            this.isLeader = this.isMultiplayerGame && Game1.player.UniqueMultiplayerID < this.enemyPlayerId;

            this.ball         = new Ball(this.state.BallPositionState, this.state.BallVelocityState);
            this.scoreDisplay = new ScoreDisplay(this.state.ScoreState);

            Paddle playerOnePaddle;
            Paddle playerTwoPaddle;

            if (!this.isMultiplayerGame)
            {
                playerTwoPaddle = new Paddle(new ComputerController(this.ball), Side.Top);
                playerOnePaddle = new Paddle(this.localPlayerController = new LocalPlayerController(this.state.PaddlePositionState), Side.Bottom);
            }
            else if (this.isLeader)
            {
                playerTwoPaddle = new Paddle(new StatePaddleController(this.followerPaddlePosition), Side.Top);
                playerOnePaddle = new Paddle(this.localPlayerController = new LocalPlayerController(this.state.PaddlePositionState), Side.Bottom);
            }
            else
            {
                playerTwoPaddle = new Paddle(new StatePaddleController(this.state.PaddlePositionState), Side.Top);
                playerOnePaddle = new Paddle(this.localPlayerController = new LocalPlayerController(this.followerPaddlePosition), Side.Bottom);
            }

            this.nonReactiveCollideables = new List <INonReactiveDrawableCollideable>
            {
                playerOnePaddle,
                playerTwoPaddle,
                new Wall(Side.Bottom),
                new Wall(Side.Left),
                new Wall(Side.Right),
                new Wall(Side.Top)
            };

            this.resetables = new List <IResetable>
            {
                playerOnePaddle
            };

            this.InitDrawables();

            if (this.isMultiplayerGame)
            {
                this.InitSync();
            }
            else
            {
                this.resetables.Add(playerTwoPaddle);
            }
        }
    // Start is called before the first frame update
    void Start()
    {
        mainCameraTransform          = GameObject.FindGameObjectWithTag("MainCamera").transform;
        mainCameraTransform.position = targetPos;
        mainCameraTransform.rotation = targetRotation;

        playerController = GetComponent <LocalPlayerController>();
        playerObj        = GetComponent <PlayerObject>();
    }
Exemple #19
0
    public void OnClick()
    {
        // Invoking the event with the player id and the option they have chosen
        LocalPlayerController localPlayerController = GameObject.FindObjectOfType <LocalPlayerController>();

        int[] data = { localPlayerController.GetComponent <PhotonView>().ViewID, (int)_CombatOptionToRepresent };
        _CombatData.CombatOptionChosenEvent.Invoke(data);
        _CombatData.CombatOptionChosenLocallyEvent.Invoke(data);
    }
    void Start()
    {
        SFServer = SmartFoxConnection.Connection;

        this.PlayerRB = this.GetComponent<Rigidbody>();
        crosshairTransform = Camera.main.transform.parent;
        this.MecAnim = this.GetComponentInChildren<Animator>();
        this.ourLPC = this.GetComponentInParent<LocalPlayerController>();
        theUI = (GameUI)FindObjectOfType(typeof(GameUI));
    }
    private static void _PlayerTankUpdateRequest(byte[] data)
    {
        PlayerTankRequest result = NetworkUtils.Deserialize <PlayerTankRequest>(data);

        if (result.Suc)
        {
            Debug.Log("收到来自服务器发送的tank位置更新包");
            LocalPlayerController.UpdateRemotePlayerStatus(result);
        }
    }
    void Start()
    {
        lineRenderer = GetComponent <LineRenderer>();
        LocalPlayerController localPC = GetComponentInParent <LocalPlayerController>();

        if (localPC != null)
        {
            Color lineColor = ColorTracker.colors[localPC.playerIndex];
            lineRenderer.SetColors(lineColor, lineColor);
        }
    }
Exemple #23
0
    public override void Start(Player player, LocalPlayerController controller, System.Object param)
    {
        base.Start(player, controller, param);
        player.SetUpperAniState(Player.StateNameHash.die, true);  //设置动画
        player.SetLowerAniState(Player.StateNameHash.die, true);  //设置动画
        Collider col = player.GetComponent <Collider>();

        col.isTrigger = true;
        controller.rigidBody.isKinematic = true;
        alreadyMsgBox = false;
    }
Exemple #24
0
    void EndGame()
    {
        gameEnded = true;
        FinalDestruction(3.5f);
        LocalPlayerController LPC = LivingPlayers[0].GetComponent <LocalPlayerController> ();
        int winningTeamInd        = 0;
        int winnerScore           = 0;

        for (int i = 0; i < teamScores.Length; i++)
        {
            if (teamScores[i] >= winScore)
            {
                scoreReached = true;
            }

            if (teamScores[i] > winnerScore)
            {
                winnerScore    = teamScores[i];
                winningTeamInd = i;
            }
        }

        if (scoreReached)
        {
            //TODO: end round
            SoundManager.play_victory_song();
            string PName = "";
            if (LivingPlayers.Count == 1)
            {
                Text   t   = playerTexts[teams[winningTeamInd]];
                string sub = t.text.Substring(0, t.text.LastIndexOf(": "));
                PName = sub + " WINS!";
            }
            else
            {
                Text   t   = playerTexts[teams[winningTeamInd]];
                string sub = t.text.Substring(0, t.text.LastIndexOf(": "));
                PName = sub + " WIN!";
            }

            Destroy(LPC.gameObject);
            cameraLoc.updatePlayers = true;
            GameObject playerMesh = Instantiate(LPC.mesh, LPC.mesh.transform.position, LPC.mesh.transform.rotation) as GameObject;
            playerMesh.transform.SetParent(GMInstance.root.transform);
            WCC.FinishGame(playerMesh, PName);
            StartCoroutine(backToLobby());
        }
        else
        {
            Destroy(LPC.gameObject);
            StartCoroutine(nextRound());
        }
    }
Exemple #25
0
    public override void Start(Player player, LocalPlayerController controller, System.Object param)
    {
        base.Start(player, controller, param);
        controller.faceYaw = controller.input.moveYaw; //调整方向
        player.SetUpperAniState(Player.StateNameHash.roll, true);
        player.SetLowerAniState(Player.StateNameHash.roll, true);
        rollForceDir = Quaternion.Euler(10, controller.faceYaw, 0) * Vector3.forward;

        AudioClip clip = (AudioClip)Resources.Load(StringAssets.soundPath + "roll", typeof(AudioClip));

        player.audioSource.PlayOneShot(clip, 0.8f);
    }
    public override void Start()
    {
        base.Start();

        endFireRate = fireRate;
        fireRate    = startFireRate;

        startPitchMin = pitchMin;
        startPitchMax = pitchMax;

        currentPlayerController = currentPlayer.GetComponent <LocalPlayerController>();
    }
Exemple #27
0
    private void RpcReturnToBase()
    {
        player = null;

        isInBase = true;
        isTaken  = false;

        SoundManager._instance.PlaySound(SoundManager.SoundList.FLAG_BACK);
        GameManager._instance.UpdateInfoText("The " + team + " has returned !");
        transform.position = teamBase.position;
        ChangeBodyType(false);
    }
 void EndGame()
 {
     gameEnded = true;
     FinalDestruction(7.5f);
     if (LivingPlayers.Count > 0)
     {
         LocalPlayerController LPC = LivingPlayers [0].GetComponent <LocalPlayerController> ();
         string     PName          = LPC.PlayerName;
         GameObject playerMesh     = Instantiate(LPC.mesh, LPC.mesh.transform.position, LPC.mesh.transform.rotation) as GameObject;
         Destroy(LPC.gameObject);
         WCC.FinishGame(playerMesh, PName);
     }
 }
Exemple #29
0
        public void StartGame()
        {
            var playingPlayers = GetAllLobbyPlayers().Where(x => x.PlayerPosition != PlayerPosition.Spectator).ToList();

            if (playingPlayers.Count < 2)
            {
                throw new InvalidActionException("Not enough players.");
            }

            _server.OnClientConnected   -= ServerOnOnClientConnected;
            _server.OnClientDisonnected -= ServerOnOnClientDisonnected; // TODO: postarat se o tyto handlery

            foreach (var lobbyPlayer in GetAllLobbyPlayers().Where(x => x.PlayerHandler != null))
            {
                lobbyPlayer.PlayerHandler.GameStarting();
            }

            // Game updaters
            var gameUpdaters = new List <IGameUpdater>();
            var localGame    = new LocalGame(_hostPlayer.PlayerId);

            gameUpdaters.Add(localGame);
            foreach (var lobbyPlayer in GetAllLobbyPlayers().Where(x => x.PlayerHandler != null))
            {
                gameUpdaters.Add(new RemoteGameUpdater(lobbyPlayer.PlayerHandler.Receiver));
            }

            var board        = new BoardFactory().CreateBoard();
            var gameSettings = new GameSettings();

            // Build the game manager
            var gameManager = new GameManager(board, gameSettings, new MultipleGameUpdater(gameUpdaters), GetAllLobbyPlayers());

            gameManager.DiceRolling = new DiceRolling(gameManager);
            gameManager.TurnLogic   = new TurnLogic(gameManager);
            gameManager.Start();

            var hostPlayer = gameManager.Players.Find(x => x.PlayerId == _hostPlayer.PlayerId);

            if (hostPlayer == null)
            {
                throw new FatalGameException("Invalid host player id");
            }

            var hostPlayerController = new LocalPlayerController(hostPlayer);

            localGame.SetPlayerController(hostPlayerController);

            GameStarting?.Invoke(localGame);
        }
Exemple #30
0
    public void SpawnPlayer(SO_LobbyDetails lobbyDetails)
    {
        _LobbyDetails          = lobbyDetails;
        _LocalPlayerController = SpawnPlayerController();

        if (PhotonNetwork.IsMasterClient)
        {
            SpawnHero(GetFreeSpawnPoint());
        }
        else
        {
            RequestSpawnPoint();
        }
    }
Exemple #31
0
    // Use this for initialization
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Player")
        {
            PlayerCollisionDetector HisPCD = coll.gameObject.GetComponent <PlayerCollisionDetector>();
            Vector2 myVelocity             = prevVelocity;
            if (HisPCD != null)
            {
                Vector2     hisVelocity = HisPCD.PrevVelocity;
                Rigidbody2D hisRbd      = coll.rigidbody;
                //Debug.Log("his velocity "+hisVelocity + " my velocity "+ myVelocity);
                if (myVelocity.magnitude >= hisVelocity.magnitude)
                {
                    //Debug.Log("My speed was: "+myVelocity.magnitude);

                    if (IsMaxSpeedKiller)
                    {
                        if (myVelocity.magnitude >= MaxPlayerSpeed)
                        {
                            if (hisVelocity.magnitude >= MaxPlayerSpeed)
                            {
                                MaxSpeedBump(HisPCD, myVelocity, coll);
                                Debug.Log("Max Speed Collision");
                            }
                            else
                            {
                                MakeBumpEffect(coll.contacts[0].point);
                                LocalPlayerController hisLCP = coll.gameObject.GetComponentInParent <LocalPlayerController>();
                                if (hisLCP.hasShield)
                                {
                                    hisLCP.DisableShield();
                                }
                                else
                                {
                                    hisLCP.DestroyObject();
                                }
                                Debug.Log("P1 At Max speed only");
                            }
                        }
                    }
                    else
                    {
                        IAmBumpKing(HisPCD, myVelocity, coll);
                    }
                    //hisRbd.ad
                }
            }
        }
    }
 public void setLPC(LocalPlayerController aLPC)
 {
     this.ourLPC = aLPC;
 }
Exemple #33
0
 void FindPlayerController()
 {
     m_playerController = m_curCharacterTarget.GetComponentInChildren<LocalPlayerController>();
 }
    public void openInventory()
    {
        if (!inventoryOpen)
        {
            //Switch Cursor Mode
            Camera.main.GetComponent<CameraController>().setCursorVisible(true);

            ourLPC = GameObject.FindObjectOfType<LocalPlayerController>();
            aInventoryPanel = ourGWM.createObject("UI/InventoryWindow");
            aInventoryPanel.name = "InventoryPanel";
            aInventoryPanel.transform.SetParent(GameObject.Find("UICanvas").transform);
            aInventoryPanel.transform.localPosition = new Vector3(300, -160, 0);

            for(int x = 0; x < 6; x++)
            {
                for(int y = 0; y < 10; y++)
                {
                    GameObject anItemSlot = (GameObject)Instantiate(Resources.Load("UI/ItemSlot", typeof(GameObject)));
                    anItemSlot.transform.parent = aInventoryPanel.transform.FindChild("Items").transform;
                    anItemSlot.name = "Item " + (x * 10 + y).ToString();
                    anItemSlot.transform.localPosition = new Vector3(-220 + (y * 45), 120 - (x * 45));
                }
            }

            foreach (KeyValuePair<int, Item> entry in ourLPC.getInventory())
            {
                if(entry.Value.inInventory())
                {
                    string path = "ItemImages/" + entry.Value.getItemID().ToString();
                    Sprite itemImageSprite = Resources.Load(path, typeof(Sprite)) as Sprite;

                    GameObject itemImageObject = aInventoryPanel.transform.FindChild("Items").FindChild("Item " + entry.Value.getPosition().ToString()).gameObject;
                    ItemImageHandler itemHandler = itemImageObject.AddComponent<ItemImageHandler>();
                    itemHandler.thisItem = entry.Value;
                    itemHandler.ourUI = this;
                    Image itemImage = itemImageObject.GetComponent<Image>();
                    itemImage.sprite = itemImageSprite;
                    Debug.Log("Set sprite.");

                    GameObject quantityText = itemImage.transform.FindChild("QuantityText").gameObject;
                    if(entry.Value.getQuantity() > 1)
                    {
                        quantityText.GetComponent<Text>().text = entry.Value.getQuantity().ToString();
                        quantityText.SetActive(true);
                    }
                    else quantityText.SetActive(false);
                }
            }
            inventoryOpen = true;
        }
        else if (inventoryOpen)
        {
            //Switch Cursor Mode
            Camera.main.GetComponent<CameraController>().setCursorVisible(false);

            if(GameObject.Find("HoverWindow") != null)
            {
                Destroy(GameObject.Find("HoverWindow"));
            }
            Destroy(aInventoryPanel);
            inventoryOpen = false;
        }
    }