Esempio n. 1
0
    IEnumerator RescueHammer()
    {
        UI_Actives.SetActive(false); // UI 숨기기
        _anim.SetBool("IsUsingActive", true);

        InteractEffector effector = new InteractEffector(currentTilePos, Floor, InteractEffector.Type.Cross, 1);

        effector.Enable();

        while (true)   // 클릭 작용시까지 반복
        {
            Vector3Int mousePos      = GetMousePosOnTilemap();
            bool       existTempWall = TileMgr.Instance.ExistTempWall(mousePos, floor);
            bool       isPossible    = effector.IsInArea(mousePos) && existTempWall;

            effector.Set(mousePos, isPossible);

            if (Input.GetMouseButtonDown(0))
            {
                if (isPossible)   // 클릭 좌표에 장애물이 있다면 제거
                {
                    SoundManager.instance.PlayWallCrash();
                    _anim.SetTrigger("ActiveSkillTrigger");
                    yield return(new WaitForSeconds(1.7f));

                    TileMgr.Instance.RemoveTempWall(mousePos, floor);
                    overcomeTraumaCount++;
                    if (overcomeTraumaCount >= 5)
                    {
                        isOverComeTrauma = true;
                    }
                    AddO2(-GetSkillUseO2());
                    if (isOverComeTrauma)
                    {
                        AddO2(10.0f);
                    }
                    else if (GameMgr.Instance.GetSurvivorAt(mousePos + (mousePos - TileMgr.Instance.WorldToCell(transform.position, floor)), floor))
                    {
                        playerAct = Action.Panic; // 턴제한 추가 필요
                    }
                }
                break;
            }
            else if (IsMoving)
            {
                break;
            }
            yield return(null);
        }
        _anim.SetBool("IsUsingActive", false);

        effector.Disable();
    }
Esempio n. 2
0
 private void InactiveUIBtns()
 {
     if (UI_Actives != null)
     {
         UI_Actives.SetActive(false);
     }
     if (UI_ToolBtns != null)
     {
         UI_ToolBtns.SetActive(false);
     }
     if (aroundInteractiveObject != null)
     {
         aroundInteractiveObject.SetActive_ConditionUI(false);
     }
 }
Esempio n. 3
0
    public override void Activate()    // 행동 UI (구조, 도구사용)
    {
        if (Input.GetMouseButtonUp(1)) // 마우스 우클릭 시 UI 표시
        {
            if (UI_Actives.activeSelf) // 이미 켜져있었다면 UI 끄기
            {
                InactiveUIBtns();
            }
            else
            {
                UI_Actives.SetActive(true);
            }
        }
        UI_Actives.transform.Find("RescueBtn").GetComponent <Button>().interactable = (_rescuingSurvivor == null);

        if (OperatorNumber != RobotDog.OPERATOR_NUMBER)
        {
            InteractiveObject interactiveObject = SearchAroundInteractiveObject(currentTilePos);
            if (interactiveObject != null && interactiveObject.IsAvailable())
            {
                SetActive_InteractBtn(true);
            }
            else
            {
                SetActive_InteractBtn(false);
            }


            if (UI_Actives.activeSelf)
            {
                if (aroundInteractiveObject != null)
                {
                    aroundInteractiveObject.SetActive_ConditionUI(false);
                }

                if (interactiveObject != null && interactiveObject.IsActive())
                {
                    interactiveObject.SetActive_ConditionUI(true);
                }
            }
            aroundInteractiveObject = interactiveObject;
        }
    }
Esempio n. 4
0
    IEnumerator Heal()
    {
        UI_Actives.SetActive(false); // UI 숨기기

        InteractEffector effector = new InteractEffector(currentTilePos, Floor, InteractEffector.Type.Cross, 1);

        effector.Enable();

        while (true)   // 클릭 작용시까지 반복
        {
            Vector3Int    mousePos      = GetMousePosOnTilemap();
            List <Player> targetPlayers = GameMgr.Instance.GetPlayersAt(mousePos, floor);
            bool          isPossible    = effector.IsInArea(mousePos) && targetPlayers.Count > 0;
            effector.Set(mousePos, isPossible);

            if (Input.GetMouseButtonDown(0))
            {
                if (isPossible)
                {
                    foreach (Player targetPlayer in targetPlayers)
                    {
                        targetPlayer.AddHP(30.0f);
                        targetPlayer.AddO2(20.0f);

                        // 산소 소비
                        AddO2(-GetSkillUseO2());
                        break;
                    }
                }
                break;
            }
            else if (IsMoving)
            {
                break;
            }

            yield return(null);
        }

        effector.Disable();
    }
Esempio n. 5
0
    public void UseTool(Tool tool) // 도구 UI의 버튼 누를 시 호출되는 함수
    {
        switch (tool)
        {
        case Tool.FIRE_EX:      StartCoroutine(UseFireExtinguisher());  break;

        case Tool.STICKY_BOMB:  StartCoroutine(UseStickyBomb());        break;

        case Tool.FIREWALL:     StartCoroutine(UseFireWall());          break;

        case Tool.FLARE:        StartCoroutine(UseFlare());             break;

        case Tool.O2_CAN:       UseO2Can();                             break;
        }

        UI_Actives.SetActive(false);
        UI_ToolBtns.SetActive(false); // UI 숨기기
        if (aroundInteractiveObject != null)
        {
            aroundInteractiveObject.SetActive_ConditionUI(false);
        }
    }
Esempio n. 6
0
    public void OnClickBehaviorBtn(int number)
    {
        switch (number)
        {
        case 0: ActiveSkill(); break;

        case 1: StartCoroutine(Rescue()); break;

        case 2: OpenToolBtns(); break;

        case 3: OnClickInteractBtn(); break;

        case 4: ActiveUltSkill(); break;
        }

        if (number != 2)
        {
            UI_Actives.SetActive(false);
            if (aroundInteractiveObject != null)
            {
                aroundInteractiveObject.SetActive_ConditionUI(false);
            }
        }
    }