Beispiel #1
0
    void Start()
    {
        screen            = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();
        _PlayerStatus     = GameObject.Find("Player").GetComponent <PlayerStatus>();
        _PlayerController = GameObject.Find("Player").GetComponent <PlayerController>();


        //TextShowData
        if (Application.loadedLevelName == "Village")
        {
            data.text += "ท่านได้เข้าสู่หมู่บ้าน";
        }
        else if (Application.loadedLevelName == "Stage_1")
        {
            data.text += "ท่านได้เข้าสู่ เส้นทางสู่ปราสาท";
        }
        else if (Application.loadedLevelName == "Stage_2")
        {
            data.text += "ท่านได้เข้าสู่ ปราสาทชั้นที่ 1";
        }
        else if (Application.loadedLevelName == "Stage_3")
        {
            data.text += "ท่านได้เข้าสู่ ปราสาทชั้นที่ 2";
        }
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        TimeSta  = GameObject.Find("TimeStage").GetComponent <TimeStage>();
        bebar    = GameObject.Find("Bebar").GetComponent <BebarBoss>();
        player   = GameObject.Find("Player");
        P_Sta    = player.GetComponent <PlayerStatus>();
        A_screen = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();

        nav = GetComponent <NavMeshAgent>();


        if (BossStage.ToString() == "Stage_1")
        {
            bossExp = 80;
        }
        else if (BossStage.ToString() == "Stage_2")
        {
            bossExp = 200;
        }
        else if (BossStage.ToString() == "Stage_3")
        {
            bossExp = 400;
        }

        itemAd  = new int[] { 4, 10, 16 };
        itemAd2 = new int[] { 4, 10, 16, 22, 28, 34 };
        itemAd3 = new int[] { 22, 28, 34 };
    }
Beispiel #3
0
    public void QuestEnd()
    {
        PlayerStatus      ps    = GameObject.Find("Player").GetComponent <PlayerStatus>();
        Inventory         inv   = GameObject.Find("InventoryManager").GetComponent <Inventory>();
        CheckActiveScreen Chack = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();
        Text textData           = GameObject.Find("Canvas").GetComponent <UI_Screen>().data;

        for (int i = 0; i < QuestComplete.Length; i++)
        {
            if (_Stage == StageComplete[i].ToString() &&
                (_Degree == "S" ? 5 : _Degree == "A" ? 4 : _Degree == "B" ? 3 : _Degree == "C" ? 2 : _Degree == "talk" ? 1 : 0) >=
                (DegreeComplete[i].ToString() == "S" ? 5 : DegreeComplete[i].ToString() == "A" ? 4 :
                 DegreeComplete[i].ToString() == "B" ? 3 : DegreeComplete[i].ToString() == "C" ? 2 :
                 DegreeComplete[i].ToString() == "talk" ? 1 : 0))
            {
                if (QuestComplete[i] == statusQuest.Active)
                {
                    ps.Exp   += Exp[i];
                    ps.Money += monney[i];
                    if (Exp[i] > 0)
                    {
                        textData.text += "\n ท่านได้รับค่าประสบการณ์ " + Exp[i] + " หน่วย";
                    }
                    if (monney[i] > 0)
                    {
                        textData.text += "\n ท่านได้รับเงิน " + monney[i] + " ฿";
                    }
                    if (Potion[i] > 0)
                    {
                        for (int j = 0; j < Potion[i]; j++)
                        {
                            inv.addItem(1);
                            inv.addItem(3);
                        }
                        textData.text += "\n ท่านได้รับยาฟื้นฟู HP,MP ขนาดใหญ่จำนวน " + Potion[i] + " ขวด";
                    }
                    StartCoroutine(inv.ScrollDown());

                    QuestComplete[i]     = statusQuest.Complete;
                    QuestComplete[i + 1] = statusQuest.Active;
                    break;
                }
            }
        }
    }
Beispiel #4
0
 void Start()
 {
     N_Screen = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();
 }
Beispiel #5
0
 void Start()
 {
     MainCamera = this.gameObject.transform.FindChild("Main Camera").gameObject;
     Chack      = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();
 }
Beispiel #6
0
 void Start()
 {
     _dataQuest = GameObject.Find("QuestManager").GetComponent <dataQuest>();
     _npc       = GameObject.Find("QuestManager").GetComponent <NPC_Talk>();
     cas        = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();
 }
Beispiel #7
0
    void Update()
    {
        N_Screen = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();
        CharacterController controller = GetComponent <CharacterController>();

        if (controller.isGrounded)
        {
            //Move
            if (!Fac.onAttack)
            {
                moveDirection  = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
                moveDirection  = transform.TransformDirection(moveDirection);
                moveDirection *= (speed + Status.item_Speed);
            }
            else
            {
                moveDirection *= 0;
            }

            if (moveDirection.x != 0 && moveDirection.z != 0)
            {
                _anim.SetBool("Walk", true);
            }
            else
            {
                _anim.SetBool("Walk", false);
            }


            //Run
            if (Input.GetKey(KeyCode.LeftShift) && moveDirection != new Vector3(0, 0, 0))
            {
                speed = (Status.Speed + Status.item_Speed) * 1.5f;
                if (moveDirection.x != 0 && moveDirection.z != 0)
                {
                    _anim.SetBool("Run", true);
                }
            }
            else
            {
                speed = Status.Speed;
                _anim.SetBool("Run", false);
            }

            if (_anim.GetCurrentAnimatorStateInfo(0).IsName("Run") && !Chack_Ef_Run)
            {
                Ef_Run.GetComponent <ParticleSystem>().Play();
                Chack_Ef_Run = true;
            }
            else if (!_anim.GetCurrentAnimatorStateInfo(0).IsName("Run"))
            {
                Ef_Run.GetComponent <ParticleSystem>().Stop();
                Chack_Ef_Run = false;
            }


            //Atk
            Any_Time += Time.deltaTime;
            Any_Atk   = Any_Time - Atk_Time;

            if (Input.GetMouseButton(0) && N_Screen.NullSreen)
            {
                _anim.SetBool("Atk", true);
                Atk_Time = Any_Time;
            }
            else if (Any_Atk >= 0.5f)
            {
                _anim.SetBool("Atk", false);
                Any_Time = 0;
                Any_Atk  = 0;
            }

            if (_anim.GetCurrentAnimatorStateInfo(0).IsName("ATK") && !Chack_Ef_ATK)
            {
                Ef_ATK.GetComponent <ParticleSystem>().Play();
                Chack_Ef_ATK = true;
            }
            else if (!_anim.GetCurrentAnimatorStateInfo(0).IsName("ATK"))
            {
                Ef_ATK.GetComponent <ParticleSystem>().Stop();
                Chack_Ef_ATK = false;
            }

            //Skill
            if (Input.GetKeyDown(KeyCode.Alpha1) && CurrentCooldownSkill[0] == 0 &&
                Status.CurrentMp >= ManaUseSkill[0] && _anim.GetBool("Walk") == false)
            {
                NumberSkillUse = 0;
                _anim.SetBool("Melee", true);
            }
            else if (Input.GetKeyDown(KeyCode.Alpha2) && CurrentCooldownSkill[1] == 0 &&
                     Status.CurrentMp >= ManaUseSkill[1] && _anim.GetBool("Walk") == false)
            {
                NumberSkillUse = 1;
                _anim.SetBool("Rage", true);
            }
            else if (Input.GetKeyDown(KeyCode.Alpha3) && CurrentCooldownSkill[2] == 0 &&
                     Status.CurrentMp >= ManaUseSkill[2] && _anim.GetBool("Walk") == false)
            {
                Skill[2].SetActive(true);
                CurrentCooldownSkill[2] = MaxCooldownSkill[2];
                CurrentBuff             = 0;
                _anim.SetBool("Buff", true);
                Status.buff_Damage += (Int32)Status.Damage * 10 / 100;
            }

            else
            {
                _anim.SetBool("Rage", false);
                _anim.SetBool("Melee", false);
                _anim.SetBool("Buff", false);
            }

            //Buff Time
            if (CurrentBuff < MaxBuff)
            {
                CurrentBuff += Time.deltaTime;
            }
            else if (CurrentBuff >= MaxBuff)
            {
                Status.buff_Damage = 0;
                Skill[2].SetActive(false);
            }



            //Jump
            _anim.SetBool("Jump", false);
            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
                _anim.SetBool("Jump", true);
            }
        }
        moveDirection.y -= gravity * Time.deltaTime;
        controller.Move(moveDirection * Time.deltaTime);


        //rage
        for (int i = 0; i < Skill.Length; i++)
        {
            if (CurrentCooldownSkill[i] > 0)
            {
                CurrentCooldownSkill[i] -= Time.deltaTime;
            }
            else
            {
                CurrentCooldownSkill[i] = 0;
            }
        }


        //Hp&Mp
        if (Input.GetKeyDown(KeyCode.Alpha4) && inv.ChackStack(0))
        {
            inv.DeleteItem(0);
            Status.CurrentHp += 400;
            Posion            = Instantiate(e_Hp, PointItem.position, PointItem.rotation) as GameObject;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha5) && inv.ChackStack(1))
        {
            inv.DeleteItem(1);
            Status.CurrentHp += Status.MaxHp * 30 / 100;
            Posion            = Instantiate(e_Hp, PointItem.position, PointItem.rotation) as GameObject;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha6) && inv.ChackStack(2))
        {
            inv.DeleteItem(2);
            Status.CurrentMp += 100;
            Posion            = Instantiate(e_Mp, PointItem.position, PointItem.rotation) as GameObject;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha7) && inv.ChackStack(3))
        {
            inv.DeleteItem(3);
            Status.CurrentMp += Status.MaxMp * 30 / 100;
            Posion            = Instantiate(e_Mp, PointItem.position, PointItem.rotation) as GameObject;
        }


        //Die
        if (Status.CurrentHp <= 0 && !_anim.GetBool("Die"))
        {
            _anim.SetBool("Die", true);
            StartCoroutine(Die(1f));
        }

        //Regend HP-MP
        if (Status.CurrentHp >= Status.MaxHp)
        {
            Status.CurrentHp = Status.MaxHp;
        }
        else if (!_anim.GetBool("Die"))
        {
            Status.CurrentHp = Status.CurrentHp + Time.deltaTime * Status.MaxHp / 1000;
        }
        if (Status.CurrentMp >= Status.MaxMp)
        {
            Status.CurrentMp = Status.MaxMp;
        }
        else if (!_anim.GetBool("Die"))
        {
            Status.CurrentMp = Status.CurrentMp + Time.deltaTime * Status.MaxMp / 1000;
        }
    }