コード例 #1
0
 public void JuageMonsterDis(PastSingle past)
 {
     if (Data.curMonster != null && Data.curMonster.transform.position.x < past.obj.transform.position.x)
     {
         Data.curMonster   = null;
         Data.TriggerTimes = 0;
         PastBtnColor pastColor = new PastBtnColor(Color.white);
         SendNotification(NotificationConstant.UIMediator.ChangeButtonColor, pastColor);
     }
 }
コード例 #2
0
 public void inAtkArea(PastSingle past)
 {
     Data.TriggerTimes += 1;
     if (Data.TriggerTimes == 1)
     {
         Data.curMonster = past.obj;
         PastBtnColor pastColor = new PastBtnColor(Color.red);
         SendNotification(NotificationConstant.UIMediator.ChangeButtonColor, pastColor);
     }
     if (Data.TriggerTimes == 2)
     {
         PastBtnColor pastColor = new PastBtnColor(Color.yellow);
         SendNotification(NotificationConstant.UIMediator.ChangeButtonColor, pastColor);
         Data.TriggerTimes = 0;
     }
 }
コード例 #3
0
    public void atkMonster(PastSingle past)
    {
        if (Data.curMonster != null)
        {
            if (Data.curMonster.name.Equals(Tags.monster_type.smallBoss))
            {
                Data.curMonster.GetComponent <SmallBoss>().Rebound(Data.smallBossRe);
            }
            else
            {
                //past.obj.GetComponent<Player>().DestroyGameObject(Data.curMonster);
                Data.curMonster.GetComponent <MonsterItem>().die();
            }

            Data.Monster     += 1;
            Data.TriggerTimes = 0;
            Data.curMonster   = null;
            SendNotification(NotificationConstant.UIMediator.ChangeMonsterCount, Data);
            PastBtnColor pastColor = new PastBtnColor(Color.white);
            SendNotification(NotificationConstant.UIMediator.ChangeButtonColor, pastColor);
        }
    }
コード例 #4
0
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        switch (notification.Name)
        {
        //执行和显示有关的命令

        case NotificationConstant.UIMediator.ChangeButtonColor:
        {
            PastBtnColor recive = notification.Body as PastBtnColor;
            Image        img    = button.GetComponent <Image>();
            img.color = recive.color;
        }
        break;

        case NotificationConstant.UIMediator.ChangeMonsterCount:
        {
            PlayerBasic pb = notification.Body as PlayerBasic;
            monsterCount.text = "" + pb.Monster;
        }
        break;

        case NotificationConstant.UIMediator.ChangeHpUI:
        {
            PlayerBasic pb = notification.Body as PlayerBasic;
            HpSlider.value = pb.Hp;
        }
        break;

        case NotificationConstant.UIMediator.ChangeCoinCount:
        {
            PlayerBasic pb = notification.Body as PlayerBasic;
            coinCount.text = "" + pb.Coin;
        }
        break;
        }
    }