/// <summary>
    /// 开始游戏
    /// </summary>
    /// <param name="theButton"></param>
    public void OnStartGameBtnClick(Button theButton)
    {
        //不建议
        MessManager.GetInstance().SendMes("SwitchState", "CreateOrChooseRoleScene");

        IUserInterfaceManager.GetInstance().CloseUI(typeof(StartGameUIConfig));
    }
    public override void Initialize()
    {
        base.Initialize();


        MessManager.GetInstance().RegisterMessage("SetMaxHpAndMp", SetMaxHpAndMp);
        MessManager.GetInstance().RegisterMessage("ChangeHPValue", ChangeHPValue);
        MessManager.GetInstance().RegisterMessage("ChangeMPValue", ChangeMPValue);
    }
    void Start()
    {
        selector = GameObject.Find("Selector").GetComponent <HotbarSelector>();
        player   = GameObject.Find("Player").GetComponent <PlayerAttack>();

        messManager = MessManager.Instance;
        material    = GetComponent <SpriteRenderer>().material;

        // Add to list of furniture
        messManager.furniture.Add(this);
    }
Beispiel #4
0
    /// <summary>
    /// 被攻击
    /// </summary>
    /// <param name="Attacker"></param>
    public override void UnderAttack(ICharacter Attacker)
    {
        Debug.Log(m_AssetName + "被" + Attacker.m_GameObject.name + "攻击了!!!" + Attacker.GetAttribute().GetAttStrategy().GetAtkPlusValue(m_Attribute));
        m_Attribute.CalDmgValue(Attacker.GetAttribute().GetAttStrategy().GetAtkPlusValue(m_Attribute));


        MessManager.GetInstance().SendMes("ChangeHPValue", m_Attribute.GetNowHP().ToString());
        if (IsKilled())
        {
            Killed();
        }
    }
Beispiel #5
0
    private void Start()
    {
        //初始化咱的UI管理类
        IUserInterfaceManager.GetInstance();

        Tips.Instance.Hide();

        // 设置开始场景
        m_SceneStateController.SetState("StartScene");

        MessManager.GetInstance().RegisterMessage("SwitchState", SwitchState);
    }
Beispiel #6
0
    /// <summary>
    /// 设置Soldier
    /// </summary>
    /// <param name="theSoldier"></param>
    public void SetSoldier(ISoldier theSoldier)
    {
        if (m_Soldier != null)
        {
            GameObject.Destroy(m_Soldier.m_GameObject);
        }
        GameObject.DontDestroyOnLoad(theSoldier.m_GameObject);
        m_Soldier = theSoldier;


        MessManager.GetInstance().RegisterMessage("Attack", (obj) =>
        {
            theSoldier.UseSkill((obj as object[])[0] as string);
        });
    }
    public void PlayerSkillInput()
    {
        //检测键盘跳跃键输入并且跳跃状态为false
        if (Input.GetKeyDown(KeyCode.C) && !isJump && !isAttack)
        {
            isJump = true; //跳跃状态赋值为true
            ReadyJump();   //执行准备跳跃方法
        }

        //检测键盘攻击键输入并且攻击状态为false
        if (Input.GetKeyDown(KeyCode.X) && !isAttack && !isJump)
        {
            isAttack = true;//攻击状态赋值为true
            MessManager.GetInstance().SendMes("Attack", "1");
        }
    }
Beispiel #8
0
 // 更新角色
 private void UpdateCharacter()
 {
     if (m_Soldier != null)
     {
         m_Soldier.Update();
     }
     if (m_Soldier.IsKilled())
     {
         if (!Tips.isShow)
         {
             Tips.Instance.ReSetTextContent("游戏结束!!!");
             Tips.Instance.ReSetBtnCallback(() =>
             {
                 MessManager.GetInstance().SendMes("SwitchState", "MainScene");
             });
             Tips.Instance.Show();
         }
     }
 }
Beispiel #9
0
    /// <summary>
    /// 通知新的关卡
    /// </summary>
    private void NotiyfNewStage()
    {
        Debug.LogError("闯关成功!!!");

        if (!Tips.isShow)
        {
            Tips.Instance.ReSetTextContent("闯关成功!!!");
            Tips.Instance.ReSetBtnCallback(() =>
            {
                MessManager.GetInstance().SendMes("SwitchState", "MainScene");
            });
            Tips.Instance.Show();
        }
        return;



        //m_GM.ShowNowStageLv(m_NowStageLv);

        // 事件
        //m_GM.NotifyGameEvent(ENUM_GameEvent.NewStage, m_NowStageLv);
    }
Beispiel #10
0
    public override void UseSkill(string v)
    {
        base.UseSkill(v);


        Debug.LogWarning("使用技能" + v);
        //先根据传过来的字段判断是哪个技能
        //再去取对应角色的配置表
        //根据技能的配置来找符合条件的被击怪物

        //P级阵地是根据AI找的目标,玩家没有AI,只能用技能的特性,自己筛选符合条件的敌人

        List <ICharacter>  characters = CharacterSystem.Instance.GetAttackTarget(5, 180);

        if (characters != null)
        {
            Debug.LogWarning("当前目标:" + characters.Count + "个\t\t^^^^^^^^^^^^^");
            if (characters.Count > 0)
            {
                IUserInterfaceManager.GetInstance().OpenUI(typeof(BloodUIConfig));
            }
            else
            {
                IUserInterfaceManager.GetInstance().CloseUI(typeof(BloodUIConfig));
            }
            //血条系统显示最后一个被打的敌人就行了
            for (int i = 0; i < characters.Count; i++)
            {
                characters[i].UnderAttack(this);
                MessManager.GetInstance().SendMes("SetCurrentEnemy", characters[i].GetAttribute() as EnemyAttr);
            }
        }
        else
        {
            Debug.LogWarning("当前没有可攻击的目标!!!!!");
        }
    }
Beispiel #11
0
 private void Awake()
 {
     Instance = this;
 }
 public override void Initialize()
 {
     base.Initialize();
     MessManager.GetInstance().RegisterMessage("SetCurrentEnemy", SetCurrentEnemy);
 }
Beispiel #13
0
 public void ShowSoldier()
 {
     m_Soldier.m_GameObject.SetActive(true);
     m_Soldier.m_GameObject.transform.position = Vector3.zero;
     MessManager.GetInstance().SendMes("SetMaxHpAndMp", new object[] { GetSoldier().GetCharacterAttr().GetMaxHP(), 1 });
 }