Exemplo n.º 1
0
 public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     if (scene.name == "Room")
     {
         CoroutineUtility.GetInstance().Do().Wait(0.5f).Then(Initial).Go();
     }
 }
Exemplo n.º 2
0
 private void Start()
 {
     CoroutineUtility.GetInstance()
     .Do()
     .UIMove(gameObject, Vector2.zero, 0.2f)
     .Go();
 }
Exemplo n.º 3
0
    public void GameOver()
    {
        Debug.Log("GameOverrrrrrrrrrrr");
        MainGameManager.getInstance().isGameOver = true;
        List <PlayerController> list             = PhotonManager.getInstance().playerList;

        CoroutineUtility.GetInstance()
        .Do()
        .Wait(1.2f)
        .Then(() => MainGameManager.getInstance().gameOverUI.SetActive(true))
        .Wait(3.5f)
        .Then(() => MainGameManager.getInstance().map.DisableBGM())
        .Then(() => ScoreManager.getInstance().scoreObj.SetActive(true))
        .Go();
        foreach (PlayerController p in list)
        {
            if (!p.isDied)
            {
                MainGameManager.getInstance().changeCameraFocusPanel.SetActive(false);
                CoroutineUtility.GetInstance()
                .Do()
                .Wait(1.5f)
                .Then(() => p.canMove = false)
                .Go();

                p.playerRig.velocity = Vector2.zero;
                ScoreManager.getInstance().SetRank(0, p);
            }
        }
        //MainGameManager.getInstance().GameOver();
    }
Exemplo n.º 4
0
 public void StartCreate(int owner)
 {
     if (PhotonNetwork.isMasterClient)
     {
         ownerID = owner;
         CoroutineUtility.GetInstance()
         .Do()
         .Then(() => CreateCatBall(dir[0], 0))
         .Then(() => CreateCatBall(dir[1], 1))
         .Then(() => CreateCatBall(dir[2], 2))
         .Wait(waitTime)
         .Then(() => CreateCatBall(dir[3], 0))
         .Then(() => CreateCatBall(dir[4], 1))
         .Then(() => CreateCatBall(dir[5], 2))
         .Wait(waitTime)
         .Then(() => CreateCatBall(dir[6], 0))
         .Then(() => CreateCatBall(dir[7], 1))
         .Then(() => CreateCatBall(dir[8], 2))
         .Wait(waitTime)
         .Then(() => CreateCatBall(dir[9], 0))
         .Then(() => CreateCatBall(dir[10], 1))
         .Then(() => CreateCatBall(dir[11], 2))
         .Then(() => Destroy(gameObject))
         .Go();
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 5
0
    public void PlayCrashEffect(Vector2 contactPoint)
    {
        GameObject effectObj = Instantiate(crashEffect, contactPoint, Quaternion.identity);

        CoroutineUtility.GetInstance()
        .Do()
        .Wait(0.5f)
        .Then(() => Destroy(effectObj))
        .Go();
    }
Exemplo n.º 6
0
 public void ChangeMap(int targetIndex)
 {
     isSlidingMap = true;
     CoroutineUtility.GetInstance()
     .Do()
     .DoEnumerator(Slide(MapContainer.gameObject, targetIndex))
     .Then(() => MoveMapPos(MapContainer.gameObject, nowMapIndex))
     .Then(() => isSlidingMap = false)
     .Go();
 }
Exemplo n.º 7
0
 public void ReStartWholeGame()
 {
     AIList     = null;
     playerList = null;
     CoroutineUtility.GetInstance().Do()
     .Then(() => SceneManager.sceneLoaded -= OnSceneFinishedLoading)
     .Then(() => Destroy(this))
     .Then(() => SceneManager.LoadScene("FirstScene"))
     .Go();
     //Destroy(gameObject);
 }
Exemplo n.º 8
0
 public void ImReady()
 {
     MainGameManager.getInstance().PlayerLoadingFinishCount++;
     if (MainGameManager.getInstance().PlayerLoadingFinishCount >= PhotonManager.getInstance().playerList.Count)
     {
         CoroutineUtility.GetInstance()
         .Do()
         .Wait(1.5f)
         .Then(() => gameObject.GetPhotonView().RPC("StartGame", PhotonTargets.All))
         .Go();
         Debug.Log("EveryBodyFinishLoading");
     }
 }
Exemplo n.º 9
0
    public void PlayAudio(string audioName, float afterTime)
    {
        if (audios == null)
        {
            InitialDictionary();
        }
        SoundEffect se = Instantiate(AudioHandler).GetComponent <SoundEffect>();

        CoroutineUtility.GetInstance()
        .Do()
        .Wait(afterTime)
        .Then(() => se.Play(audios[audioName]))
        .Go();
    }
Exemplo n.º 10
0
    public void Initial(int index, int id, bool isAI, string nickName)
    {
        int wait = 1;

        if (SceneManager.GetActiveScene().name == "Tutorial")
        {
            wait = 0;
        }
        CoroutineUtility.GetInstance()
        .Do()
        .Wait(wait)
        .Then(() => SpawnAnimation.SetActive(true))
        .Wait(0.3f)
        .Then(() => playerSprite.SetActive(true))
        .Wait(1f)
        .Then(() => SpawnAnimation.SetActive(false))
        .Go();
        this.isAI = isAI;
        if (PhotonManager.getInstance().playerList == null)
        {
            PhotonManager.getInstance().playerList = new List <PlayerController>();
        }
        PhotonManager.getInstance().playerList.Add(this);
        ID                  = id;
        this.index          = index;
        this.NickName       = nickName;
        PlayerNameText.text = nickName;
        if (isOwner())
        {
            OnSceneLoaded();
            MainGameManager.getInstance().player = this;
            if (SceneManager.GetActiveScene().name == "Tutorial")
            {
                TutorialManager.GetInstance().player = this;
            }
            //MainUIManager.instance.UpdateHealthBar(hp);
            SaveData playerData = EntireGameManager.getInstance().playerData;
            SetCharacterSprite(playerData.nowEquipment.animal, playerData.nowEquipment.cup, playerData.nowEquipment.liquid);
            gameObject.GetPhotonView().RPC("SetCharacterSprite", PhotonTargets.All, playerData.nowEquipment.animal, playerData.nowEquipment.cup, playerData.nowEquipment.liquid);
            GameObject inputer = PhotonNetwork.Instantiate("FakeInputer", Vector3.zero, Quaternion.identity, 0);
            fakeInputer          = inputer.GetComponent <FakeInputer>();
            fakeInputer.playerID = id;
            inputer.GetPhotonView().RPC("SetID", PhotonTargets.MasterClient, id);
            gameObject.GetPhotonView().RPC("SetSkill", PhotonTargets.All, playerData.nowEquipment.animal);
        }
        else if (isAI && PhotonNetwork.isMasterClient)
        {
            OnSceneLoaded();
        }
    }
Exemplo n.º 11
0
    void checkInput()
    {
        //float x = joystick.Horizontal;
        //float y = joystick.Vertical;

        //target.x += x;
        //target.y += y;

        //forceFoward = new Vector2(x, y);
        if (MainGameManager.getInstance().isGameOver)
        {
            return;
        }
        if (isAI)
        {
            if (AITime > 1)
            {
                float x = UnityEngine.Random.Range(-6, 7);
                float y = UnityEngine.Random.Range(-6, 7);
                forceFoward = new Vector2(x, y);
                if (isAIFocusEnemy && UnityEngine.Random.Range(0, 2) >= 1)
                {
                    forceFoward = AIFocusEnemy.transform.position - transform.position;
                }
                CoroutineUtility.GetInstance().Do().Wait(0.6f).Then(() => forceFoward = Vector2.zero).Go();
                if (mp >= 100)
                {
                    gameObject.GetPhotonView().RPC("UseSkill", PhotonTargets.All);
                }
                AITime = 0;
            }
        }
        if (canMove)
        {
            playerRig.AddForce(forceFoward * (0.1f * (maxVelcocity + speedBuff)), ForceMode2D.Impulse);
            if (Vector2.Distance(Vector2.zero, playerRig.velocity) > maxVelcocity + speedBuff)
            {
                playerRig.velocity = playerRig.velocity.normalized * (maxVelcocity + speedBuff);
            }
        }


        //photonView.RPC("PlayerMove", PhotonTargets.MasterClient, forceFoward);
        //playerRig.AddForce(forceFoward * 1.5f, ForceMode2D.Impulse);
        //if (Vector2.Distance(Vector2.zero, playerRig.velocity) > maxVelcocity)
        //    playerRig.velocity = playerRig.velocity.normalized * maxVelcocity;
    }
Exemplo n.º 12
0
 public void OnSkillFirstUsed(float waitTime)
 {
     if (!MainGameManager.getInstance().canUseSkill)
     {
         return;
     }
     if (index != 12)
     {
         return;
     }
     if (HaveUseSkill)
     {
         return;
     }
     HaveUseSkill = true;
     CoroutineUtility.GetInstance().Do().Wait(waitTime).Then(() => SetPlayerCanMove(false)).Then(StopPlayer).Then(() => CanAIMove(false)).Then(StopAI).Then(MoveNext).Go();
 }
Exemplo n.º 13
0
    public void UseSkill()
    {
        if (mp < 100)
        {
            return;
        }
        mp = 0;
        UpdateSkillBarValue(0);
        canUseSkill = false;
        if (skill.isPlayAnim)
        {
            playerAnimator.Play("UseSkill");
        }
        if (isOwner())
        {
            AudioManager.Play("skill");
        }
        CoroutineUtility.GetInstance()
        .Do()
        .Wait(skill.time)
        .Then(() => PlayIdleAnime())
        .Go();
        MainUIManager.instance.OnSkillUsed(animal);
        if (PhotonNetwork.isMasterClient)
        {
            gameObject.GetPhotonView().RPC("UpdateSkillBarValue", PhotonTargets.All, 0);
            for (int i = 0; i < skill.ObjToCreate.Count; i++)
            {
                GameObject itemObj = PhotonNetwork.InstantiateSceneObject(skill.ObjToCreate[i].name, transform.position, skill.ObjToCreate[i].transform.rotation, 0, null);
                if (skill.ObjToCreate[i].GetComponent <PickedItem>().isAttachPlayer)
                {
                    itemObj.GetPhotonView().RPC("SetTransform", PhotonTargets.All, ID, skill.ObjToCreate[i].transform.position, skill.ObjToCreate[i].transform.localScale, skill.time);
                }
                else
                {
                    itemObj.GetPhotonView().RPC("SetOwnerID", PhotonTargets.All, ID);
                    Vector3 pos = transform.position;
                    pos.z = -0.5f;

                    itemObj.transform.position   = pos + new Vector3(0, 0, UnityEngine.Random.Range(-0.1f, 0.1f));
                    itemObj.transform.localScale = skill.ObjToCreate[i].transform.localScale;
                }
            }
        }
    }
Exemplo n.º 14
0
    public void SwitchAnimalShop(int slideType)
    {
        int targetIndex;

        if (isSlidingAnimal)
        {
            return;
        }
        if (slideType == 1)
        {
            if (nowAnimalIndex + 1 >= animals.Count)
            {
                targetIndex    = nowAnimalIndex + 1;
                nowAnimalIndex = 0;
            }
            else
            {
                nowAnimalIndex++;
                targetIndex = nowAnimalIndex;
            }
        }
        else
        {
            if (nowAnimalIndex <= 0)
            {
                targetIndex    = nowAnimalIndex - 1;
                nowAnimalIndex = animals.Count - 1;
            }
            else
            {
                nowAnimalIndex--;
                targetIndex = nowAnimalIndex;
            }
        }
        isSlidingAnimal = true;
        CoroutineUtility.GetInstance()
        .Do()
        .DoEnumerator(Slide(animalShop.gameObject, targetIndex))
        .Then(() => MoveShopPos(animalShop.gameObject, nowAnimalIndex))
        .Then(() => isSlidingAnimal = false)
        .Go();
        ChangeImageSprite(playerAnimalImage, animals[nowAnimalIndex].SelectViewSprite);
        ChangeSkillDescript(animals[nowAnimalIndex].skillName, animals[nowAnimalIndex].skillDescript);
    }
Exemplo n.º 15
0
    public void SwitchLiquidShop(int slideType)
    {
        int targetIndex;

        if (isSlidingLiquid)
        {
            return;
        }
        if (slideType == 1)
        {
            if (nowLiquidIndex + 1 >= liquids.Count)
            {
                targetIndex    = nowLiquidIndex + 1;
                nowLiquidIndex = 0;
            }
            else
            {
                nowLiquidIndex++;
                targetIndex = nowLiquidIndex;
            }
        }
        else
        {
            if (nowLiquidIndex <= 0)
            {
                targetIndex    = nowLiquidIndex - 1;
                nowLiquidIndex = liquids.Count - 1;
            }
            else
            {
                nowLiquidIndex--;
                targetIndex = nowLiquidIndex;
            }
        }
        isSlidingLiquid = true;
        CoroutineUtility.GetInstance()
        .Do()
        .DoEnumerator(Slide(liquidShop.gameObject, targetIndex))
        .Then(() => MoveShopPos(liquidShop.gameObject, nowLiquidIndex))
        .Then(() => isSlidingLiquid = false)
        .Go();
        ChangeImageSprite(playerLiquidImage, liquids[nowLiquidIndex].SelectViewSprite);
    }
Exemplo n.º 16
0
    public override void ApplyEffect(PlayerController player)
    {
        itemList = new List <GameObject>();
        base.ApplyEffect(player);
        for (int i = 0; i < ObjToCreate.Count; i++)
        {
            GameObject itemObj = PhotonNetwork.InstantiateSceneObject(ObjToCreate[i].name, player.transform.position, ObjToCreate[i].transform.rotation, 0, null);
            itemList.Add(itemObj);
            itemObj.GetPhotonView().RPC("SetTransform", PhotonTargets.All, player.ID, new Vector3(0, 0, -2), ObjToCreate[i].transform.localScale, (float)time);
            itemObj.transform.localPosition = new Vector3(0, 0, -2);
            itemObj.transform.localScale    = ObjToCreate[i].transform.localScale;
        }

        ItemFactory.getInstance().nowItemCount--;
        CoroutineUtility.GetInstance()
        .Do()
        .Then(() => player.AddSpeedBuff(SpeedUpValue))
        .Wait(time)
        .Then(() => player.AddSpeedBuff(-SpeedUpValue))
        .Go();
    }
Exemplo n.º 17
0
 public override void ApplyEffect(PlayerController player)
 {
     base.ApplyEffect(player);
     for (int i = 0; i < UIObjList.Count; i++)
     {
         player.gameObject.GetPhotonView().RPC("CreateUIObject", PhotonTargets.AllBuffered, UIObjList[i]);
     }
     if (SceneManager.GetActiveScene().name != "Tutorial")
     {
         ItemFactory.getInstance().nowItemCount--;
     }
     else if (player.isAI)
     {
         return;
     }
     CoroutineUtility.GetInstance()
     .Do()
     .Wait(waitTime)
     .Then(() => player.gameObject.GetPhotonView().RPC("AddHP", PhotonTargets.AllBuffered, hpValue))
     .Then(() => player.gameObject.GetPhotonView().RPC("AddMP", PhotonTargets.AllBuffered, mpValue))
     .Go();
 }
Exemplo n.º 18
0
    public void SpawnTutorialAI()
    {
        Vector3 pos        = new Vector3(0, 0, -1) - player.transform.position;
        Vector3 spawnPoint = player.transform.position + (pos.normalized * 6);

        spawnPoint.z = -1;
        Character ch;

        ch.animal = "dog";
        ch.cup    = "teacup";
        ch.liquid = "wine";
        ch.name   = "阿福";
        GameObject       playerObj        = PhotonNetwork.InstantiateSceneObject(PhotonManager.getInstance().playerObj.name, spawnPoint, PhotonManager.getInstance().playerObj.transform.rotation, 0, null);
        PlayerController playerController = playerObj.GetComponent <PlayerController>();
        TutorialObject   tutorialObj      = playerObj.AddComponent <TutorialObject>();

        tutorialObj.triggerType = TriggerType.OnCollisionEnter;
        if (tutorialObj.TriggerTurtorialEvent == null)
        {
            tutorialObj.TriggerTurtorialEvent = new UnityEvent();
        }
        tutorialObj.TriggerTurtorialEvent.AddListener(MoveNext);
        tutorialObj.TriggerTurtorialEvent.AddListener(() => SetPlayerCanMove(false));
        tutorialObj.TriggerTurtorialEvent.AddListener(() => player.Damaged(8));
        tutorialObj.TriggerTurtorialEvent.AddListener(StopPlayer);
        tutorialObj.TriggerTurtorialEvent.AddListener(() => CoroutineUtility.GetInstance().Do().Wait(1f).Then(StopAI).Go());
        tutorialObj.TriggerTurtorialEvent.AddListener(() => CoroutineUtility.GetInstance().Do().Wait(0.2f).Then(() => Destroy(tutorialObj)).Go());
        //playerList.Add(playerController);

        PhotonManager.getInstance().playerList.Add(playerController);
        int id = -1;

        playerController.willDamaged = false;
        playerObj.GetPhotonView().RPC("Initial", PhotonTargets.AllBuffered, 2, id, true, ch.name);
        playerObj.GetPhotonView().RPC("SetCharacterSprite", PhotonTargets.AllBuffered, ch.animal, ch.cup, ch.liquid);
        playerObj.GetPhotonView().RPC("SetSkill", PhotonTargets.AllBuffered, ch.animal);
        playerController.canMove = false;
        tutorialAI = playerController;
    }
Exemplo n.º 19
0
 private void OnSceneFinishedLoading(Scene scene, LoadSceneMode mode)
 {
     Debug.Log("loadscene");
     if (scene.name == "Room")
     {
         PhotonNetwork.BackgroundTimeout      = 180;
         PhotonNetwork.automaticallySyncScene = false;
         PhotonNetwork.isMessageQueueRunning  = true;
         if (playerList != null)
         {
             playerList.Clear();
         }
         spawnRoomPlayer();
         SocialManager.ReadQueue(this);
     }
     else if (scene.name == "MainGame")
     {
         if (PhotonNetwork.isMasterClient)
         {
             PhotonNetwork.BackgroundTimeout = 10;
         }
         map = MainGameManager.getInstance().InitialMap((string)PhotonNetwork.room.CustomProperties["Map"]);
         CoroutineUtility.GetInstance()
         .Do()
         .Wait(0.2f)
         .Then(() => spawnPlayer(playerObj, map.spawnPoint))
         .Go();
         //spawnPlayer(playerObj, map.spawnPoint);
     }
     else if (scene.name == "Tutorial")
     {
         map = MainGameManager.getInstance().InitialMap((string)PhotonNetwork.room.CustomProperties["Map"]);
     }
     else if (scene.name == "RoomList")
     {
         SocialManager.ReadQueue(this);
     }
 }
Exemplo n.º 20
0
 public void StartGame()
 {
     if (SceneManager.GetActiveScene().name != "Tutorial")
     {
         //AudioManager.Play("StartCount");
         StartCountAnimation.gameObject.SetActive(true);
         CoroutineUtility.GetInstance()
         .Do()
         .Wait(3)
         .Then(() => SetAllPlayerCanMove(true))
         .Then(() => isGameStart = true)
         .Go();
         CoroutineUtility.GetInstance()
         .Do()
         .Play(StartCountAnimation, "StartCount")
         .Then(() => StartCountAnimation.gameObject.SetActive(false))
         .Then(() => map.EnalbeBGM())
         .Go();
     }
     else
     {
         isGameStart = true;
     }
 }
Exemplo n.º 21
0
    public void StartBoardAnimation()
    {
        if (!MainGameManager.getInstance().isGameOver || SceneManager.GetActiveScene().name == "Tutorial")
        {
            countDownText.gameObject.SetActive(false);
            countDownBackText.gameObject.SetActive(false);
            return;
        }
        CoroutineUtility.GetInstance()
        .Do()
        .Play(GetComponent <Animator>(), "ScoreBoardIn")
        .Wait(0.8f)
        .Then(() => countDownText.text = "9")
        .Wait(0.8f)
        .Then(() => countDownText.text = "8")
        .Wait(0.8f)
        .Then(() => countDownText.text = "7")
        .Wait(0.8f)
        .Then(() => countDownText.text = "6")
        .Wait(0.8f)
        .Then(() => countDownText.text = "5")
        .Then(DestroyAllPlayers)
        .Wait(0.8f)
        .Then(() => countDownText.text = "4")
        .Wait(0.8f)
        .Then(() => countDownText.text = "3")
        .Wait(0.8f)
        .Then(() => countDownText.text = "2")
        .Wait(0.8f)
        .Then(() => countDownText.text = "1")
        .Wait(0.8f)
        .Then(() => {
            PhotonNetwork.LoadLevel("Room");
        })
        .Go();
        if (!EntireGameManager.getInstance().playerData.HavePlayingMultiPlayerGame&& SceneManager.GetActiveScene().name != "Tutorial")
        {
            EntireGameManager.getInstance().playerData.HavePlayingMultiPlayerGame = true;
            SocialManager.UnlockAchievement(LiquidKnightResources.achievement_2);
            SocialManager.AddAchievementQueue("派對!", 5);
        }
        if (MainGameManager.getInstance().player.animal == "cat")
        {
            EntireGameManager.getInstance().playerData.CatPlayTime++;
            if (EntireGameManager.getInstance().playerData.CatPlayTime == 5)
            {
                SocialManager.UnlockAchievement(LiquidKnightResources.achievement_3);
                SocialManager.AddAchievementQueue("貓型玩家", 5);
            }
        }
        else if (MainGameManager.getInstance().player.animal == "dog")
        {
            EntireGameManager.getInstance().playerData.DogPlayTime++;
            if (EntireGameManager.getInstance().playerData.DogPlayTime == 5)
            {
                SocialManager.UnlockAchievement(LiquidKnightResources.achievement_4);
                SocialManager.AddAchievementQueue("狗型玩家", 5);
            }
        }
        else if (MainGameManager.getInstance().player.animal == "fish")
        {
            EntireGameManager.getInstance().playerData.FishPlayTime++;
            if (EntireGameManager.getInstance().playerData.FishPlayTime == 5)
            {
                SocialManager.UnlockAchievement(LiquidKnightResources.achievement_5);
                SocialManager.AddAchievementQueue("魚型玩家", 5);
            }
        }

        EntireGameManager.getInstance().Save();
    }
Exemplo n.º 22
0
 public void StopPlayer()
 {
     player.playerRig.velocity = Vector2.zero;
     CoroutineUtility.GetInstance().Do().Wait(0.3f).Then(() => player.playerRig.velocity = Vector2.zero);
 }
Exemplo n.º 23
0
 // Use this for initialization
 void Start()
 {
     CoroutineUtility.GetInstance().Do().Wait(2).Then(() => Destroy(gameObject)).Go();
 }
Exemplo n.º 24
0
    public void PlayerDied()
    {
        animalObj.gameObject.SetActive(false);
        cupObj.gameObject.SetActive(false);
        liquidObj.gameObject.SetActive(false);
        MinimapIconSprite.gameObject.SetActive(false);
        PlayerNameText.gameObject.SetActive(false);
        GetComponent <Collider2D>().enabled = false;
        canMove = false;
        hp      = 0;
        isDied  = true;
        canMove = false;
        DeadAnimation.SetActive(true);
        if (isOwner() || MainGameManager.getInstance().player.targetFocus.GetComponent <PlayerController>() == this)
        {
            CoroutineUtility.GetInstance()
            .Do()
            .Wait(1.5f)
            .Then(() => MainGameManager.getInstance().ChangeCameraFocus())
            .Then(() => MainGameManager.getInstance().changeCameraFocusPanel.SetActive(true))
            .Go();
        }

        if (isOwner())
        {
            MainGameManager.getInstance().canUseSkill = false;
        }

        if (PhotonNetwork.isMasterClient)
        {
            int rank = OnPlayerDied();
            gameObject.GetPhotonView().RPC("SetPlayerRank", PhotonTargets.All, rank);
            if (rank == 1)
            {
                Debug.Log("GameOver");
                gameObject.GetPhotonView().RPC("GameOver", PhotonTargets.All);
            }
            else if (rank == 3 || rank == 2)
            {
                PlayerController targetEnemy  = null;
                PlayerController targetEnemy2 = null;
                int count = 0;
                foreach (PlayerController pl in PhotonManager.getInstance().playerList)
                {
                    if (!pl.isDied)
                    {
                        count++;
                        if (count <= 1)
                        {
                            targetEnemy = pl;
                        }
                        else
                        {
                            targetEnemy2 = pl;
                            break;
                        }
                    }
                }
                foreach (PlayerController pl in PhotonManager.getInstance().playerList)
                {
                    if (pl.isAI)
                    {
                        pl.isAIFocusEnemy = true;
                        if (pl == targetEnemy)
                        {
                            pl.AIFocusEnemy = targetEnemy2;
                        }
                        else
                        {
                            pl.AIFocusEnemy = targetEnemy;
                        }
                    }
                }
            }
        }
    }