Esempio n. 1
0
    void Start()
    {
        cont = transform.GetComponent <SurvivorRecogRangeCollider>();

        controller     = GetComponent <CharacterController>();
        survivorStatus = GetComponent <SurvivorStatus>();
        playerAnimator = this.gameObject.GetComponent <Animator>();
        Inventory      = GetComponent <SurvivorInventory>();
        survivorAudio  = GetComponent <SurvivorAudio>();
        ragDoll        = GameObject.Find("/Survivor/Bip001/Bip001 Pelvis"); //레그돌
        ScreenMidPoint = new Vector3(Screen.width / 2, Screen.height / 2, 0f);

        BearCollider            = transform.Find("RecogRangeColliderGroup").Find("BearRecogRangeCollider").gameObject;
        BeeCollider             = transform.Find("RecogRangeColliderGroup").Find("BeeRecogRangeCollider").gameObject;
        BoarCollider            = transform.Find("RecogRangeColliderGroup").Find("BoarRecogRangeCollider").gameObject;
        SnakeCollider           = transform.Find("RecogRangeColliderGroup").Find("SnakeRecogRangeCollider").gameObject;
        recogRangeColliderGroup = transform.Find("RecogRangeColliderGroup").gameObject;

        Action = false;
        //Fire1 = false;
        Fire2 = false;
        Sneak = false;

        runSpeedBackUp = runSpeed;
    }
Esempio n. 2
0
    IEnumerator DamageOverTime(SurvivorStatus target, float timer) //지속데미지 입히는 함수
    {
        SurvivorStatus DOTTarget = target;

        DOTTarget.addtoHP((int)(-attackDamage), transform.position, gameObject.tag);                                                             //처음 맞을때 생명력 감소
        while (!target.transform.GetComponent <SurvivorStatus>().IsDead() && target.transform.GetComponent <SurvivorStatus>().Infection == true) // 죽지않고 감염되있을때
        {
            //타이머당 지속피해
            yield return(new WaitForSeconds(timer));

            if (target.transform.GetComponent <SurvivorStatus>().Infection == true)
            {
                DOTTarget.addtoHP((int)(-attackDamage * 0.2), gameObject.tag);
            }
            else if (target.transform.GetComponent <SurvivorStatus>().Infection == false)
            {
                yield break;
            }
        }
    }
Esempio n. 3
0
    IEnumerator Attack()
    {
        if (Audio != null)
        {
            Audio.Play("Attack");
        }

        while (state == State.Attack)
        {
            //업데이트 할때
            if (Target.transform.root.GetComponent <SurvivorStatus>().IsDead())
            {
                state = State.Idle;
            }
            //공격범위 벗어나면 다시 추격
            if (!AttackRange.IsAttack)
            {
                animator.SetBool("Attack", false);
                state = State.Guard;
            }

            SurvivorStatus DOTTarget = Target.GetComponent <SurvivorStatus>();
            if (Target.transform.GetComponent <SurvivorStatus>().Infection == false)
            {
                GameController.GetInstance().ActionMessage("Wrong", "뱀에게 물렸습니다.", Target);
                Target.transform.GetComponent <SurvivorStatus>().Infection      = true;            // 감염상태 True로
                Target.transform.GetComponent <SurvivorStatus>().InfectionColor = getSnakeColor(); //감염된 뱀의 색깔 넘기기
                StartCoroutine(DamageOverTime(DOTTarget, DOTTimer));
            }
            else
            {
                DOTTarget.addtoHP((int)(-attackDamage), transform.position, gameObject.tag); //처음 맞을때 생명력 감소
            }

            state = State.Guard;
            yield return(new WaitForSeconds(4.0f));
        }
        //벗어날때
        GoToNextState();
    }
Esempio n. 4
0
    void Start()
    {
        walkSound      = SetUpEngineAudioSource(walkSound_c, 0.5f, true);
        heartSound     = SetUpEngineAudioSource(heartSound_c, 1f, true);
        jumpSound      = SetUpEngineAudioSource(jumpSound_c, 0.5f, false);
        waterWalkSound = SetUpEngineAudioSource(waterWalkSound_c, 0.3f, true);

        behitSound = new AudioSource[behitSound_c.Length];
        for (int i = 0; i < behitSound_c.Length; i++)
        {
            behitSound[i] = SetUpEngineAudioSource(behitSound_c[i], 0.15f, false);
        }

        deathSound = new AudioSource[deathSound_c.Length];
        for (int i = 0; i < deathSound_c.Length; i++)
        {
            deathSound[i] = SetUpEngineAudioSource(deathSound_c[i], 0.5f, false);
        }

        survivorController = GetComponent <SurvivorController>();
        survivorStatus     = GetComponent <SurvivorStatus>();
    }
Esempio n. 5
0
    void Start()
    {
        SurvivorInventory survivorInventory = GetComponent <SurvivorInventory>();

        survivorInventory.enabled = true;

        SurvivorStatus survivorStatus = GetComponent <SurvivorStatus>();

        survivorStatus.enabled    = true;
        survivorStatus.PlayerID   = ID;
        survivorStatus.PlayerName = playerName;
        gameObject.name           = playerName;
        transform.Find("PlayerNameText").GetComponent <TextMesh>().text = playerName;

        if (GameController.GetInstance() != null)
        {
            GameController.GetInstance().GameControllerInit();
        }

        survivorStatus.uiSurvivor = GameObject.Find("UI/Canvas/SurvivorPanel").GetComponent <UISurvivor>();
        survivorStatus.uiSurvivor.SurvivorUIStart();

        SetClothColor(playerColor);
    }