Esempio n. 1
0
    public void instantiateCharacterON()
    {
        for (int i = 0; i < playerInitialNum; i++)
        {
            player = (GameObject)Instantiate(Resources.Load("GamePlay/Prefab_" + characterInfoListON[i].prefabID), new Vector3(0, 0, 0), Quaternion.identity);
            player.transform.SetParent(wholePrefab.transform);
            player.transform.position        = generatedPosition();
            player.transform.GetChild(3).tag = "Camera_Active";
            player.transform.tag             = "Player";
            player.transform.name            = "Player_" + (i + 1).ToString();
            print(player.transform.position);

            EachCharacterStat tempStat = player.transform.GetChild(1).GetComponent <EachCharacterStat>();
            tempStat.characterID  = characterInfoListON[i].ID_Character_Global;
            tempStat.name         = characterInfoListON[i].name;
            tempStat.level        = characterInfoListON[i].level;
            tempStat.experience   = characterInfoListON[i].experience;
            tempStat.health       = characterInfoListON[i].health_total;
            tempStat.damage       = characterInfoListON[i].damage_total;
            tempStat.weaponRange  = characterInfoListON[i].weaponRange_total;
            tempStat.speed        = characterInfoListON[i].speed_total;
            tempStat.defense      = characterInfoListON[i].defense_total;
            tempStat.criticalRate = characterInfoListON[i].criticalRate_total;
            tempStat.prefabID     = characterInfoListON[i].prefabID.ToString();
            tempStat.maxHealth    = characterInfoListON[i].health_total;
        }
    }
Esempio n. 2
0
    public void instantiateCharacterON()
    {
        for (int i = 0; i < playerInitialNum; i++)
        {
            enemy = (GameObject)Instantiate(Resources.Load("GamePlay/" + characterInfoListON[i].prefabID), new Vector3(0, 0, 0), Quaternion.identity);
            enemy.transform.SetParent(wholePrefab.transform);
            enemy.transform.position        = generatedPosition();
            enemy.transform.GetChild(3).tag = "Camera_notActive";
            enemy.transform.tag             = "Enemy";
            enemy.transform.name            = "Enemy_" + (i + 1).ToString();
            print(enemy.transform.position);

            EachCharacterStat tempStat = enemy.transform.GetChild(1).GetComponent <EachCharacterStat>();
            tempStat.characterID  = characterInfoListON[i].characterID;
            tempStat.name         = characterInfoListON[i].name;
            tempStat.level        = characterInfoListON[i].level;
            tempStat.health       = characterInfoListON[i].health;
            tempStat.damage       = characterInfoListON[i].damage;
            tempStat.weaponRange  = characterInfoListON[i].weaponRange;
            tempStat.speed        = characterInfoListON[i].speed;
            tempStat.defense      = characterInfoListON[i].defense;
            tempStat.criticalRate = characterInfoListON[i].criticalRate;
            tempStat.prefabID     = characterInfoListON[i].prefabID;
            tempStat.maxHealth    = characterInfoListON[i].health;
        }
    }
Esempio n. 3
0
    void LateUpdate()
    {
        try
        {
            if (GameObject.Find("GamePlayManager").GetComponent <CameraWalk>().enabledCamera.transform.name != "MainCamera")
            {
                try
                {
                    theCharacter     = GameObject.Find("GamePlayManager").GetComponent <CameraWalk>().enabledCamera.transform.GetComponent <Camera_Each>().target;
                    theCharacterStat = theCharacter.transform.GetChild(1).GetComponent <EachCharacterStat>();

                    float tempDist = (Mathf.Round(theCharacterStat.aimedDistance * 100) * 0.01f);

                    theInput = "\t" + theCharacterStat.name + "\n";
                    theInput = theInput + "HP\t " + theCharacterStat.health + " / " + theCharacterStat.maxHealth + "\n";
                    theInput = theInput + "방어력\t " + theCharacterStat.defense + "\n";
                    theInput = theInput + "DMG\t " + theCharacterStat.damage + "\n";
                    theInput = theInput + "무기 거리\t " + theCharacterStat.weaponRange + "\n";
                    theInput = theInput + "타겟 거리\t " + tempDist.ToString() + "\n";
                    theInput = theInput + "포션 수\t  " + theCharacterStat.potionCount.ToString() + "\n";

                    theInfo.text = theInput;

                    if (GameObject.Find("GamePlayManager").transform.GetComponent <CameraWalk>().enabledCamera.GetComponent <Camera_Each>().target.transform.GetComponent <CharacterMovement>().actionImage != "")
                    {
                        //image_action.SetActive(true);
                        //image_condition.SetActive(true);

                        image_action.GetComponent <RawImage>().texture = Resources.Load <Texture>("CodeEditor/" + GameObject.Find("GamePlayManager").transform.GetComponent <CameraWalk>().enabledCamera.GetComponent <Camera_Each>().target.transform.GetComponent <CharacterMovement>().actionImage);
                        for (int i = 0; i < 9; i++)
                        {//일단 리셋
                            image_condition_each[i].SetActive(false);
                        }
                        for (int i = 0; i < GameObject.Find("GamePlayManager").transform.GetComponent <CameraWalk>().enabledCamera.GetComponent <Camera_Each>().target.transform.GetComponent <CharacterMovement>().conditionImages.Length; i++)
                        {
                            image_condition_each[i].SetActive(true);
                            image_condition_each[i].GetComponent <RawImage>().texture = Resources.Load <Texture>("CodeEditor/" + GameObject.Find("GamePlayManager").transform.GetComponent <CameraWalk>().enabledCamera.GetComponent <Camera_Each>().target.transform.GetComponent <CharacterMovement>().conditionImages[i]);
                            image_condition_each[i].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = GameObject.Find("GamePlayManager").transform.GetComponent <CameraWalk>().enabledCamera.GetComponent <Camera_Each>().target.transform.GetComponent <CharacterMovement>().conditionValues[i];
                            image_condition_each[i].transform.GetChild(1).GetComponent <RawImage>().texture     = Resources.Load <Texture>("CodeEditor/Arrow_" + GameObject.Find("GamePlayManager").transform.GetComponent <CameraWalk>().enabledCamera.GetComponent <Camera_Each>().target.transform.GetComponent <CharacterMovement>().conditionStates[i]);
                        }
                    }
                }
                catch (System.Exception)
                {
                }
            }
            else
            {
                image_action.SetActive(false);
                image_condition.SetActive(false);
                statBox.GetComponent <RectTransform>().sizeDelta = new Vector2(1000, 1200);
                theInput = "내 캐릭터 수\t " + GameObject.Find("GamePlayManager").GetComponent <GameEndCheck>().players.Length.ToString() + "\n";
                theInput = theInput + "내 적 수\t " + GameObject.Find("GamePlayManager").GetComponent <GameEndCheck>().enemies.Length.ToString() + "\n";

                theInfo.text = theInput;
            }
        }
        catch (System.Exception)
        {
        }
    }
Esempio n. 4
0
    public bool CheckConditionValue(string conditionName, float conditionValue)
    {
        bool b = false;
        EachCharacterStat stat = this.transform.GetChild(1).GetComponent <EachCharacterStat>();

        // 해야될 것
        //     DPS를 제대로 계산하기
        //         현재는 damage로 통일

        switch (conditionName)
        {
        case "HPMT":
            b = HPMT(stat.health, conditionValue);
            break;

        case "HPLT":
            b = HPLT(stat.health, conditionValue);
            break;

        case "DPSMT":
            b = DPSMT(stat.damage, conditionValue);
            break;

        case "DPSLT":
            b = DPSLT(stat.damage, conditionValue);
            break;

        case "EnemyMT":
            b = ENEMYMT(stat.enemyNumInRange, conditionValue);
            break;

        case "EnemyLT":
            b = ENEMYLT(stat.enemyNumInRange, conditionValue);
            break;

        case "IsStunned":
            b = IsStunned(stat.isStunned, conditionValue);
            break;

        case "BuffedAtk":
            b = BuffedAtk(stat.buffedAtk, conditionValue);
            break;

        case "DebuffedAtk":
            b = DebuffedAtk(stat.debuffedAtk, conditionValue);
            break;

        case "BuffedDef":
            b = BuffedDef(stat.buffedDef, conditionValue);
            break;

        case "DebuffedDef":
            b = DebuffedDef(stat.debuffedAtk, conditionValue);
            break;

        case "OAuseWeapon":
            b = OAuseWeapon(oAuseWeapon, conditionValue);
            break;

        case "OAuseHealthPotion":
            b = OAuseHealthPotion(oAuseHealthPotion, conditionValue);
            break;

        case "OAmoveForward":
            b = OAmoveForward(oAmoveForward, conditionValue);
            break;

        case "OAmoveBackward":
            b = OAmoveBackward(oAmoveBackward, conditionValue);
            break;

        case "OAmoveLeft":
            b = OAmoveLeft(oAmoveLeft, conditionValue);
            break;

        case "OAmoveRight":
            b = OAmoveRight(oAmoveRight, conditionValue);
            break;

        case "OAmoveNorth":
            b = OAmoveNorth(oAmoveNorth, conditionValue);
            break;

        case "OAmoveSouth":
            b = OAmoveSouth(oAmoveSouth, conditionValue);
            break;

        case "OAmoveWest":
            b = OAmoveWest(oAmoveWest, conditionValue);
            break;

        case "OAmoveEast":
            b = OAmoveEast(oAmoveEast, conditionValue);
            break;

        default:
            break;
        }
        return(b);
    }
Esempio n. 5
0
    void OnCollisionEnter(Collision collision)
    {
        Debug.Log("collision on " + collision.collider.gameObject.name);

        try
        {
            if (collision.collider.gameObject.name != this.transform.GetComponent <Bullet>().player.name&& collision.collider.gameObject.tag != "Bullet")
            {
                //Debug.Log("bullet hit");
                GameObject effect = Instantiate(hitEffect, transform.position, Quaternion.identity);
                effect.transform.GetChild(0).GetComponent <ParticleSystem>().Play();
                Destroy(effect, 1.0f);
                Destroy(gameObject);
                enemy = collision.collider.gameObject;
                //Debug.Log("enemy.tag = " + enemy.tag);

                if (enemy.tag == "Enemy")
                {
                    Image             theImage = enemy.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <Image>();
                    EachCharacterStat theStat  = enemy.transform.GetChild(1).GetComponent <EachCharacterStat>();
                    enemy.transform.GetComponent <CharacterMovement>().isHit = true;

                    float calcDamage;
                    if (theStat.health - damage < 0)
                    {
                        calcDamage = theStat.health;
                    }
                    else
                    {
                        calcDamage = damage;
                    }
                    float newHealthPercentage = (theStat.health - calcDamage) / theStat.maxHealth;
                    theStat.health -= calcDamage;
                    DOTween.To(() => theImage.fillAmount, x => theImage.fillAmount = x, newHealthPercentage, 1.0f);
                }
                else if (enemy.tag == "Player")
                {
                    Image             theImage = enemy.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <Image>();
                    EachCharacterStat theStat  = enemy.transform.GetChild(1).GetComponent <EachCharacterStat>();
                    enemy.transform.GetComponent <CharacterMovement>().isHit = true;

                    float calcDamage;
                    if (theStat.health - damage < 0)
                    {
                        calcDamage = theStat.health;
                    }
                    else
                    {
                        calcDamage = damage;
                    }

                    float newHealthPercentage = (theStat.health - calcDamage) / theStat.maxHealth;
                    theStat.health -= calcDamage;
                    DOTween.To(() => theImage.fillAmount, x => theImage.fillAmount = x, newHealthPercentage, 1.0f);
                }
            }
        }
        catch (System.Exception)
        {
        }
    }