Inheritance: ActorInfo
示例#1
0
    /// <summary>
    /// 购买僵尸按钮
    /// </summary>
    /// <param name="btn"></param>
    private void btnCardsOnClick(Button btn)
    {
        var p = BattleManager.Instance.leftPlayer;

        if (p._ZombieMgr.GetAllZombie().Count == BattleManager.Instance.maxBagZombie)
        {
            TipsManager.Instance.TipsShow("背包数量已满无法购买");
        }
        if (int.Parse(btn.transform.Find("gold/Text").GetComponent <Text>().text) <= p.GetGold())
        {
            CardConfig  card   = CardConfigData.Instance.GetCard(Intercept.Instance.GetIdForBuyName(btn.name));
            SkillConfig skill  = SkillConfigData.Instance.GetSkill(card.skill);
            ZombieInfo  zombie = new ZombieInfo();
            //zombie.id = type;
            //type++;
            zombie.cardId   = card.id;
            zombie.cardName = card.cardName;
            zombie.gold     = card.gold;
            zombie.profile  = skill.profile;
            zombie.atk      = card.atk;
            zombie.maxHp    = card.hp;
            zombie.atkSpeed = card.atkSpeed;
            zombie.atkRange = card.atkRange;
            zombie.level    = card.level;
            p._ZombieMgr.AddZombie(zombie, 1);
            EventManager.getMe().GoldRemove(card.gold); //p.RemoveGold(card.gold);
            BagWndUIController.getMe().Notify();
            // ChooseCard(BattleWndUIController.GetRound());
            Notify();
        }
    }
    public void SpawnEnemy(ZombieInfo zombieInfo)
    {
        GameObject prefab = null;

        if (zombieInfo is NormalZombieInfo)
        {
            prefab = NormalZombiePrefab;
        }
        else if (zombieInfo is BucketZombieInfo)
        {
            prefab = BucketZombiePrefab;
        }
        GameObject enemy = Instantiate(prefab, GetRandomPosition(), prefab.transform.rotation);

        RotateEnemy(enemy);
        EnemyStatistics enemyStatistics = enemy.GetComponent <EnemyStatistics>();

        enemyStatistics.MovementSpeed   = zombieInfo.MovementSpeed;
        enemyStatistics.HealtPoints     = zombieInfo.MaxHealtPoints;
        enemyStatistics.MaxHealtPoints  = zombieInfo.MaxHealtPoints;
        enemyStatistics.AttackDamage    = zombieInfo.AttackDamage;
        enemyStatistics.Weight          = zombieInfo.Weight;
        enemyStatistics.MinimalDistance = zombieInfo.MinimalDistance;
        AliveEnemies.Add(enemy);
    }
示例#3
0
    /// <summary>
    /// 把当前僵尸焦点到下一层的地板焦点
    /// </summary>
    void MoveZombieNodeToGround(ZombieInfo zombie)
    {
        //var ground = GroundManager.getMe().GetGround(Intercept.getMe().GetPosForCardName(zombieControl.gameObject.name));
        var ground = GroundManager.getMe().GetGround(zombie.pos);

        BattleWndUIController.getMe().GetBasekeyState().setCurKey(ground);
        ground.interactable = true;
    }
示例#4
0
 public NMessageInfo(MessageInfo info)
 {
     id           = info.Id;
     type         = info.Type;
     zombieInfo   = info.ZombieInfo;
     fightingInfo = info.FightingInfo;
     time         = info.Time;
     isRead       = info.IsRead;
 }
    // Use this for initialization
    void Start()
    {
        reshuffle(testWords);

        for (int i = 0; i < testWords.Length; i++)
        {
            ZombieInfo info = new ZombieInfo(testWords[i], "");
            WordQueue.AddInfoToPremadeQueue(info);
        }
    }
示例#6
0
 public ZombieController GetZombieController(ZombieInfo zombie)
 {
     foreach (var item in myCards_ZC)
     {
         if (item.Value.zombie == zombie)
         {
             return(item.Value);
         }
     }
     return(null);
 }
示例#7
0
 /// <summary>
 /// 背包是否包含僵尸
 /// </summary>
 /// <param name="card"></param>
 /// <returns></returns>
 public bool ContainsZombie(ZombieInfo card)
 {
     for (int i = 0; i < bagZombies.Count; i++)
     {
         if (bagZombies[i].zombie.cardId == card.cardId)
         {
             return(true);
         }
     }
     return(false);
 }
示例#8
0
 public MyZombie GetZombie(ZombieInfo zombie)
 {
     for (int i = 0; i < bagZombies.Count; i++)
     {
         if (zombie.cardId == bagZombies[i].zombie.cardId)
         {
             return(bagZombies[i]);
         }
     }
     return(null);
 }
示例#9
0
    private void Awake()
    {
        prefab   = PrefabPool.GetPrefab();
        zombie   = new ZombieInfo();
        wayPoint = WayPoints.wayPoints;

        string name = gameObject.tag;

        switch (name)
        {
        case "Zombie_1":
            zombie.Speed        = 15;
            zombie.Blood        = 100;
            zombie.Aggressivity = 100;
            zombie.ZombieType   = ZombieType.Zombie_1;
            break;

        case "Zombie_2":
            zombie.Speed        = 20;
            zombie.Blood        = 200;
            zombie.Aggressivity = 200;
            zombie.ZombieType   = ZombieType.Zombie_2;
            break;

        case "Zombie_3":
            zombie.Speed        = 25;
            zombie.Blood        = 300;
            zombie.Aggressivity = 300;
            zombie.ZombieType   = ZombieType.Zombie_3;
            break;

        case "Zombie_4":
            zombie.Speed        = 30;
            zombie.Blood        = 400;
            zombie.Aggressivity = 400;
            zombie.ZombieType   = ZombieType.Zombie_4;
            break;

        case "Zombie_5":
            zombie.Speed        = 40;
            zombie.Blood        = 500;
            zombie.Aggressivity = 500;
            zombie.ZombieType   = ZombieType.Zombie_5;
            break;

        default:
            Debug.Log("none of the zombie");
            break;
        }
    }
示例#10
0
 public bool RemoveZombie(ZombieInfo card, int count)
 {
     for (int i = 0; i < bagZombies.Count; i++)
     {
         if (bagZombies[i].zombie.cardId == card.cardId && bagZombies[i].count >= count)
         {
             bagZombies[i].count -= count;
             if (bagZombies[i].count == 0)
             {
                 bagZombies.Remove(bagZombies[i]);
             }
             return(true);
         }
     }
     return(false);
 }
    // Use this for initialization


    //spawns zombie and returns
    public WordZombie SpawnZombie(ZombieInfo info)
    {
        Vector3 spawnPoint  = Vector3.forward * Radius + Vector3.up * 0.4f;
        float   randomAngle = Random.value * spawnArcAngle - spawnArcAngle / 2f;

        spawnPoint = Quaternion.Euler(0, randomAngle, 0) * spawnPoint;

        GameObject thisZombie = Object.Instantiate(ZombiePrefab, spawnPoint, Quaternion.identity) as GameObject;

        thisZombie.transform.LookAt(GameObject.FindGameObjectWithTag("Player").transform);

        WordZombie wordZombie = thisZombie.GetComponent <WordZombie> ();

        wordZombie.SetInfo(info);

        return(wordZombie);
    }
示例#12
0
    /// <summary>
    /// 添加背包指定数量僵尸
    /// </summary>
    /// <param name="card"></param>
    public bool AddZombie(ZombieInfo card, int count)
    {
        for (int i = 0; i < bagZombies.Count; i++)
        {
            if (bagZombies[i].zombie.cardId == card.cardId)
            {
                bagZombies[i].count += count;
                return(true);
            }
        }
        MyZombie zombie = new MyZombie();

        zombie.zombie = card;
        zombie.count  = 1;
        bagZombies.Add(zombie);
        return(false);
    }
示例#13
0
    public void UpdateText(List <WordZombie> currentZombies)
    {
        Words.text     = "";
        Usernames.text = "";

        for (int i = 0; i < currentZombies.Count; i++)
        {
            ZombieInfo info = currentZombies[i].GetInfo();
            Words.text     += info.word;
            Usernames.text += info.user;

            if (i < currentZombies.Count - 1)
            {
                Words.text     += "\n";
                Usernames.text += "\n";
            }
        }
    }
    private void ZombieUpdate()
    {
        //should handle the timer stuff here
        zombieTimer += Time.deltaTime;
        if (zombieTimer > spawnRate)
        {
            //should get word from word queue

            if (currentZombies.Count < maxZombies && WordQueue.HasNextZombieInfo() == true)
            {
                ZombieInfo info = WordQueue.GetNextZombieInfo();
                if (ZombieFactory != null)
                {
                    currentZombies.Add(ZombieFactory.SpawnZombie(info));
                }
            }
            zombieTimer = 0;
        }
    }
示例#15
0
    /// <summary>
    /// 设置卡牌显示
    /// </summary>
    /// <param name="thisCard"></param>
    public void SetCardShow(ZombieInfo thisCard)
    {
        BuyWndUIController.getMe().ClearStar(hpContent);
        BuyWndUIController.getMe().ClearStar(atkContent);
        CardConfig  cardData  = CardConfigData.Instance.GetCard(thisCard.cardId);
        SkillConfig skillData = SkillConfigData.Instance.GetSkill(cardData.skill);

        //if (cardData == null)
        //    return;
        textName.text    = cardData.cardName;
        textProfile.text = skillData.profile;

        var sprite = ZombieCardResource.Instance.GetCardSprite(thisCard.cardId, thisCard.level);

        zombieShow.sprite = sprite;

        BuyWndUIController.getMe().CreateStar(cardData.hpStar, cardData.hpHalfStar, star, hpContent);
        BuyWndUIController.getMe().CreateStar(cardData.atkStar, cardData.atkHalfStar, star, atkContent);
        cardShow.gameObject.SetActive(true);
    }
示例#16
0
    void ZombieMessage()
    {
        for (int i = 0; i < GameManager.npcList.Count; i++)
        {
            if (GameManager.npcList[i].GetComponent <Zombie>())
            {
                float distance = Vector3.Distance(GameManager.npcList[i].transform.position, transform.position);

                if (distance < 5 && heroDead == false)
                {
                    zombieInfo = GameManager.npcList[i].GetComponent <Zombie>().GetInfo();
                    gameManager.zombieDialogue.text = "Te comeré tu " + zombieInfo.bodyParts;
                    gameManager.zomDiagAnimator.SetBool("abierto", true); // muestra mensaje
                }
                else if (heroDead == true)
                {
                    gameManager.zomDiagAnimator.SetBool("abierto", false); // esconde mensaje
                }
            }
        }
    }
示例#17
0
    void Move(ZombieInfo zombie)
    {
        if (nextPoint >= wayPoint.Length)
        {
            //被打死TODO
            Destroy(gameObject, 1f);
            return;
        }

        //朝向拐点目标向量
        //Vector3 unitVector = (wayPoint[nextPoint].position - transform.position).normalized;
        //transform.Translate(unitVector * Time.deltaTime * speed);
        float step = zombie.Speed * Time.deltaTime;

        transform.position = Vector3.MoveTowards(transform.position, wayPoint[nextPoint].localPosition, step);
        transform.LookAt(wayPoint[nextPoint].localPosition);
        if (Vector3.Distance(transform.position, wayPoint[nextPoint].position) < 0.2f)
        {
            nextPoint++;
        }
    }
示例#18
0
    /// <summary>
    /// 卖僵尸
    /// </summary>
    /// <param name="zombie"></param>
    float SoldZombie(ZombieInfo zombie)
    {
        float money = 0;

        //根据等级返还金币
        switch (zombie.level)
        {
        case 1:
            money = zombie.gold * 0.5f;
            break;

        case 2:
            money = zombie.gold * 0.5f * 3;
            break;

        case 3:
            money = zombie.gold * 0.5f * 9;
            break;
        }
        EventManager.getMe().GoldAdd(money);
        return(money);
    }
示例#19
0
    /// <summary>
    /// 注册地图图标
    /// </summary>
    /// <param name="btn"></param>
    private void btnOnClick(Button btn)
    {
        //

        if (uiMgr.getMe().FindUI(MenuWndUIController.ui_name) != null)
        {
            if (MenuWndUIController.getMe().MovePutDown() == true)
            {
                return;
            }
        }


        if (p._ZombieMgr.GetAllZombie().Count < 1)
        {
            return;
        }
        //if (uiMgr.getMe().FindUI(BagWndUIController.ui_name) == null)
        //{
        //    BagWndUIController.ShowOrHide(true);
        //}
        //else
        //{
        uiMgr.Instance.setTopUI(BagWndUIController.ui_name);
        BagWndUIController.getMe().SetFirstBtnOnNode();
        //}
        //Debug.Log("btn");
        //var g = BagWndUIController.getMe().getCurButton().name;


        ZombieInfo thisCard = p._ZombieMgr.GetZombie(Intercept.Instance.GetCardIdForBagName(BagWndUIController.getMe().getCurButton().name)).zombie;

        if (thisCard == null)
        {
            return;
        }
        BagWndUIController.getMe().SetCardShow(thisCard);
    }
示例#20
0
    //public void AddWordToQueue(string word){
    //	queue.Enqueue (word);
    //}

    public void AddInfoToQueue(ZombieInfo info)
    {
        queue.Enqueue(info);
    }
示例#21
0
    //public void AddWordToPremadeQueue(string word){
    //	premadeQueue.Enqueue (word);
    //}

    public void AddInfoToPremadeQueue(ZombieInfo info)
    {
        premadeQueue.Enqueue(info);
    }
 public void SetInfo(ZombieInfo info)
 {
     this.info      = info;
     wordLabel.text = info.word;
 }
 public void AddInfoToWordQueue(ZombieInfo info)
 {
     WordQueue.AddInfoToQueue(info);
 }