void Awake()
 {
     anim           = GetComponent <Animator> ();
     playerAudio    = GetComponent <AudioSource> ();
     playerMovement = GetComponent <PlayerMovement> ();
     playerShooting = GetComponentInChildren <PlayerShooting>();
     playerExp      = GetComponent <PlayerExp>();
     currentHealth  = startingHealth;
     startPos       = transform.position;
 }
예제 #2
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        PlayerExp player = hitInfo.GetComponent <PlayerExp>();

        if (player != null)
        {
            Destroy(transform.parent.gameObject);
            player.addEXP(exp);
        }
    }
예제 #3
0
            public static List <PlayerExp> LoadDatas()
            {
                CSVFile csvFile = new CSVFile();

                csvFile.Open(csvFilePath);
                List <PlayerExp> dataList = new List <PlayerExp>();

                for (int i = 0; i < csvFile.mapData.Count; i++)
                {
                    PlayerExp data = new PlayerExp();
                    int.TryParse(csvFile.mapData[i].data[0], out data.id);
                    int.TryParse(csvFile.mapData[i].data[1], out data.playerExp);
                    dataList.Add(data);
                }
                return(dataList);
            }
예제 #4
0
    private float GetExpRatio()
    {
        int           level = OwnerData.Instance.Level;
        PlayerExpInfo info  = PlayerExp.GetPlayerExpInfo(level);

        if (info == null)
        {
            return(0.0f);
        }

        if (info.Exp < 1)
        {
            return(0.0f);
        }

        return((float)OwnerData.Instance.Exp / (float)info.Exp);
    }
예제 #5
0
    public void UpdatePlayerGroup()
    {
        playerGroup.Clear();
        GameObject[] players;
        players = GameObject.FindGameObjectsWithTag("Player");
        for (int i = 0; i < players.Length; i++)
        {
            PlayerIndenfity pIdenfity = players[i].GetComponent <PlayerIndenfity>();
            if (!pIdenfity)
            {
                Debug.Log("pIdenfity " + i + " null");
                return;
            }

            PlayerExp pExp = players[i].GetComponent <PlayerExp>();
            if (!pExp)
            {
                Debug.Log("PlayerExp " + i + " null");
                return;
            }

            PlayerScore pScore = players[i].GetComponent <PlayerScore>();
            if (!pScore)
            {
                Debug.Log("pScore " + i + " null");
                return;
            }

            PlayerHealth pHealth = players[i].GetComponent <PlayerHealth>();
            if (!pHealth)
            {
                Debug.Log("pHealth " + i + " null");
                return;
            }

            PlayerIdentifytion p;
            p.playerID     = pIdenfity.playerID;
            p.playerExp    = pExp;
            p.playerScore  = pScore;
            p.playerHealth = pHealth;
            playerGroup.Add(p);
        }
    }
예제 #6
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == origin)
        {
            return;
        }
        if (isPlayer)
        {
            if (other.tag == bossTag)
            {
                //Debug.Log("hit");

                BossHealth hp = other.gameObject.GetComponent <BossHealth>();
                //give the player exp too
                PlayerExp exp = playerRef.GetComponent <PlayerExp>();
                hp.TakeDamage(exp.bulletDamage * bulletDamage);
                exp.GainExp(hitExp);

                Destroy(gameObject);
            }
        }
        else
        {
            if (other.tag == playerTag)
            {
                PlayerHealth hp = other.gameObject.GetComponent <PlayerHealth>();
                hp.TakeDamage(bulletDamage);
                Destroy(gameObject);
            }
        }
        if (other.tag != bullet)
        {
            if (isPlayer && other.tag == "Ground")
            {
                return;
            }
            Destroy(gameObject);
        }
    }
예제 #7
0
    void Start()
    {
        BOSSList bosslist = new BOSSList();

        IBOSS pigboss0 = new PigBoss("猪猪侠", 100, 1);
        IBOSS pigboss1 = new PigBoss("猪八戒", 150, 2);
        IBOSS dogboss0 = new DogBoss("哮天犬", 200, 1);
        IBOSS dogboss1 = new DogBoss("牧羊犬", 100, 2);
        IBOSS dogboss2 = new DogBoss("藏獒", 300, 3);

        bosslist.AddBoss(pigboss0);
        bosslist.AddBoss(pigboss1);
        bosslist.AddBoss(dogboss0);
        bosslist.AddBoss(dogboss1);
        bosslist.AddBoss(dogboss2);

        IVisitor visitor  = new PlayerExp();
        IVisitor visitor1 = new PlayerPower();

        bosslist.Accept(visitor);
        bosslist.Accept(visitor1);
    }
예제 #8
0
 void Start()
 {
     playerRef = this.gameObject;
     hp        = playerRef.GetComponent <PlayerHealth>();
     exp       = playerRef.GetComponent <PlayerExp>();
 }