Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        var cols = Physics2D.OverlapCircleAll(transform.position, radius, LayerMask.GetMask("enemy"));

        foreach (var col in cols)
        {
            var enemy_ctr = col.GetComponent <NetkActorController>();
            if (enemy_ctr && !enemys.Contains(enemy_ctr) && photonView.IsMine)
            {
                enemys.Add(enemy_ctr);
            }
        }
        timer += Time.deltaTime;
        if (timer >= attack_timer_interval)
        {
            foreach (var enemy in enemys)
            {
                if (!enemy)
                {
                    timer = 0;
                    return;
                }
                enemy.GetHurt(new AttackData(
                                  model.GetHurtValue(),
                                  false,
                                  transform.position,
                                  HitType.普通
                                  ));
                timer = 0;
            }
        }
    }
Esempio n. 2
0
 public override void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         View.CurrentScene.GetView <GameInfoView>().HitCount++;
         if (attack_type == HitType.击飞)
         {
             Camera.main.GetComponent <Cinemachine.CinemachineImpulseSource>().GenerateImpulse();
             TimeModel.SetTimeScale(0.2f, true, 0.2f);
         }
         collision.gameObject.GetComponent <IHurt>().GetHurt(
             new AttackData(model.GetHurtValue(), false, transform.position, attack_type)
             );
     }
 }
 public override void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         if (photonView.Owner.ActorNumber == collision.GetComponent <NetkActorController>().photonView.Owner.ActorNumber)
         {
             return;
         }
         if (attack_type == HitType.击飞)
         {
             Camera.main.GetComponent <Cinemachine.CinemachineImpulseSource>().GenerateImpulse();
             //  Time.timeScale = 0.2f;
         }
         collision.gameObject.GetComponent <IHurt>().GetHurt(
             new AttackData(model.GetHurtValue(), false, transform.position, attack_type)
             );
     }
 }
Esempio n. 4
0
    public void UpdateModel()
    {
        if (model == null)
        {
            return;
        }
        intro_text.text = model._config.skill_des.Replace("t", "<color=#FF9A00>" + (int)model.GetHurtValue() + "</color>");
        double needMoney = 0;

        if (!model.IsLearn())
        {
            needMoney = model.GetLearnMoney();
            level_up_button.GetComponentInChildren <Text>().text = "学习";
            level_up_info_text.text = "学习需要金钱:" + ((ActorModel.Model.GetMoney() >= needMoney) ? "<color=green>" : "<color=red>") + needMoney + "</color>";
        }
        else
        {
            needMoney = model.GetLevelUpMoney();
            level_up_button.GetComponentInChildren <Text>().text = "升级";
            level_up_info_text.text = DreamerUtil.GetColorRichText("\t\t等级:" + model.GetSkillLevel(), Color.white) + "\n升级所需金钱: " + ((ActorModel.Model.GetMoney() >= needMoney) ? "<color=green>" : "<color=red>") + needMoney + " </color>";
        }

        level_up_button.interactable = ActorModel.Model.GetMoney() >= needMoney;
        level_up_button.GetComponentInChildren <Text>().color = ActorModel.Model.GetMoney() >= needMoney ? Color.yellow : Color.gray;
    }
Esempio n. 5
0
    public void UpdateModel()
    {
        skill_info.text = m_model._config.skill_des.Replace("t", "<color=#FF9A00>" + (int)m_model.GetHurtValue() + "</color>");;
        if (m_model.IsLearn())
        {
            SetButtons(true);


            for (int i = 0; i < m_skill_button.Length; i++)
            {
                if (ActorModel.Model.equip_skil[i] == m_model)
                {
                    m_skill_button[i].gameObject.SetActive(false);
                }
            }
        }
        else
        {
            SetButtons(false);
        }
    }