Example #1
0
 public void Initialize()
 {
     _errorGO            = GameObject.Find("ErrorGO");
     _errorText          = GameObject.Find("losText").GetComponent <Text>();
     _player             = GameObject.Find("Player");
     _playerTurn         = _player.GetComponent <PlayerTurn>();
     _apBar              = GameObject.Find("APbar");
     _apRect             = _apBar.GetComponent <RectTransform>();
     _apBack             = GameObject.Find("APback").GetComponent <RectTransform>();
     _hpBar              = GameObject.Find("HPbar");
     _hpRect             = _hpBar.GetComponent <RectTransform>();
     _hpBack             = GameObject.Find("HPback").GetComponent <RectTransform>();
     _apLoss             = GameObject.Find("APLoss");
     _apLossRect         = _apLoss.GetComponent <RectTransform>();
     _apImage            = _apLoss.GetComponent <Image>();
     _moveIndicator      = GameObject.Find("Player").GetComponent <MoveIndicator>();
     _toolTip            = gameObject.GetComponent <Tooltip>();
     _moveCost           = GameObject.Find("MoveCost").GetComponent <Text>();
     _moveButton         = GameObject.Find("ToggleMove").GetComponent <Button>();
     _toggleAttackButton = GameObject.Find("ToggleAttack").GetComponent <Button>();
     _attackAbutton      = GameObject.Find("AttackTypeA").GetComponent <Button>();
     _attackBbutton      = GameObject.Find("AttackTypeB").GetComponent <Button>();
     _attackCbutton      = GameObject.Find("AttackTypeC").GetComponent <Button>();
     _calc     = GameObject.Find("_combatMan").GetComponent <CalculateDamage>();
     _auxPower = GameObject.Find("_combatMan").GetComponent <AuxilliaryPower>();
     _hpap     = GameObject.Find("HP/AP");
     _hpapText = GameObject.Find("HP/AP Text").GetComponent <Text>();
     _hpap.SetActive(false);
     _pauseMenu = GameObject.Find("PauseMenu");
     _errorGO.SetActive(false);
     _pauseMenu.SetActive(false);
     DeactivateButtons(false);
     UpdateHealth();
 }
Example #2
0
    private void AttackDummy(int hitActionID, List <uint> dummys)
    {
        Dictionary <uint, List <int> > wounded = new Dictionary <uint, List <int> >();

        for (int i = 0; i < dummys.Count; i++)
        {
            List <int> harm = new List <int>();
            if (!MogoWorld.Entities.ContainsKey(dummys[i]))
            {
                continue;
            }
            EntityParent e = MogoWorld.Entities[dummys[i]];
            if (Utils.BitTest(e.stateFlag, StateCfg.NO_HIT_STATE) == 1 || Utils.BitTest(e.stateFlag, StateCfg.DEATH_STATE) == 1)
            {//不可击中状态
                continue;
            }
            harm = CalculateDamage.CacuDamage(hitActionID, theOwner.ID, dummys[i]);
            // harm[1] = 100000;
            if ((e as EntityDummy).MonsterData.clientBoss == 1)
            {//为体验关特制
                harm[1] = harm[1] * 1000 + RandomHelper.GetRandomInt(100);
            }
            //harm[1] = 10000;
            if (MogoWorld.unhurtDummy)
            {
                harm[1] = 0;
            }
            wounded.Add(dummys[i], harm);
            uint h = 0;
            h        = e.curHp < harm[1] ? e.curHp : (uint)harm[1];
            e.curHp -= h;
        }
        TriggerDamage(hitActionID, wounded);
        for (int i = 0; i < dummys.Count; i++)
        {
            if (!MogoWorld.Entities.ContainsKey(dummys[i]))
            {
                continue;
            }
            EntityParent e = MogoWorld.Entities[dummys[i]];
            AttackEnemyGenAnger(e); //计算怒气
            if (e.curHp <= 0)
            {                       //前端怪死亡
                MogoWorld.thePlayer.RpcCall("CliEntityActionReq", e.ID, (uint)1, (uint)(e.Transform.position.x * 100.0f), (uint)(e.Transform.position.z * 100.0f));
                e.OnDeath(hitActionID);
                (e as EntityDummy).stateFlag = Mogo.Util.Utils.BitSet((e as EntityDummy).stateFlag, StateCfg.DEATH_STATE);
            }
        }
        TriggerCombo(dummys.Count);
    }
Example #3
0
    private void AttackPlayer(int hitActionID, List <uint> players)
    {
        Dictionary <uint, List <int> > wounded = new Dictionary <uint, List <int> >();

        for (int i = 0; i < players.Count; i++)
        {
            List <int> harm = new List <int>();
            harm    = CalculateDamage.CacuDamage(hitActionID, theOwner.ID, players[i]);
            harm[1] = harm[1];
            if (MogoWorld.unhurtMe)
            {
                harm[1] = 0;
            }
            wounded.Add(players[i], harm);
            if (players[i] == MogoWorld.thePlayer.ID)
            {
                EventDispatcher.TriggerEvent(Events.ComboEvent.ResetCombo);
                if (theOwner is EntityDummy && (theOwner as EntityDummy).MonsterData.clientBoss == 1)
                {//为体验关特制
                    continue;
                }
                if (MogoWorld.thePlayer.IsNewPlayer)
                {
                    continue;
                }
                if (MogoWorld.thePlayer.curHp <= harm[1])
                {
                    MogoWorld.thePlayer.curHp = 0;
                    MogoWorld.thePlayer.RpcCall("CliEntityActionReq", MogoWorld.thePlayer.ID, (uint)2, MogoWorld.thePlayer.curHp, (uint)0);
                }
                else
                {
                    MogoWorld.thePlayer.curHp -= (uint)harm[1];
                }
                AttackSelfGenAnger(MogoWorld.thePlayer); //产生怒气
                continue;
            }
            if (!MogoWorld.Entities.ContainsKey(players[i]))
            {
                continue;
            }
            EntityParent e = MogoWorld.Entities[players[i]];
            uint         h = 0;
            h        = e.curHp < harm[1] ? e.curHp : (uint)harm[1];
            e.curHp -= h;
        }
        TriggerDamage(hitActionID, wounded);
    }
Example #4
0
    private void AttackMercenary(int hitActionID, List <uint> mercenarys)
    {//只有dummy打mercenary才会进此方法,所以mercenary肯定是纯雇佣兵
        Dictionary <uint, List <int> > wounded = new Dictionary <uint, List <int> >();

        for (int i = 0; i < mercenarys.Count; i++)
        {
            List <int> harm = new List <int>();
            if (!MogoWorld.Entities.ContainsKey(mercenarys[i]))
            {
                continue;
            }
            EntityParent e = MogoWorld.Entities[mercenarys[i]];
            if (!(e.m_factionFlag > 0))
            {
                continue;
            }
            if (Utils.BitTest(e.stateFlag, StateCfg.NO_HIT_STATE) == 1 || Utils.BitTest(e.stateFlag, StateCfg.DEATH_STATE) == 1)
            {//不可击中状态
                continue;
            }
            harm = CalculateDamage.CacuDamage(hitActionID, theOwner.ID, mercenarys[i]);
            // harm[1] = 0;
            // harm[1] = 100000;
            wounded.Add(mercenarys[i], harm);
            if (theOwner is EntityMyself)
            {//用于标记是否是PVP主角打离线玩家
                harm.Add(1);
                continue;
            }
            if (e.curHp < harm[1])
            {
                e.curHp = 0;
                Int16 x    = (Int16)(e.Transform.position.x * 100);
                Int16 z    = (Int16)(e.Transform.position.z * 100);
                byte  face = (byte)(e.Transform.eulerAngles.y * 0.5);
                MogoWorld.thePlayer.RpcCall("UpdateMercenaryCoord", e.ID, x, z, face, 0);
            }
            else
            {
                e.curHp -= (uint)harm[1];
            }
        }
        TriggerDamage(hitActionID, wounded);
    }
    private void AttackMonster(int hitActionID, List <uint> dummys)
    {
        Dictionary <uint, List <int> > wounded = new Dictionary <uint, List <int> >();

        for (int i = 0; i < dummys.Count; i++)
        {
            List <int> harm = new List <int>();
            if (!GameWorld.Entities.ContainsKey(dummys[i]))
            {
                continue;
            }
            EntityParent e = GameWorld.Entities[dummys[i]];
            //if (Utils.BitTest(e.stateFlag, StateCfg.NO_HIT_STATE) == 1 || Utils.BitTest(e.stateFlag, StateCfg.DEATH_STATE) == 1)
            //{//不可击中状态
            //    continue;
            //}
            harm = CalculateDamage.CacuDamage(hitActionID, owner.ID, dummys[i]);

            wounded.Add(dummys[i], harm);
            int h = 0;
            h = (int)(e.curHp < harm[1] ? (uint)e.curHp : (uint)harm[1]);
            e.propertyManager.ChangeProperty(PropertyType.HP, -h);
        }
        TriggerDamage(hitActionID, wounded);
        for (int i = 0; i < dummys.Count; i++)
        {
            if (!GameWorld.Entities.ContainsKey(dummys[i]))
            {
                continue;
            }
            EntityParent e = GameWorld.Entities[dummys[i]];
            //AttackEnemyGenAnger(e);//计算怒气
            if (e.curHp <= 0)
            {//前端怪死亡
                //TODO发送消息
                e.OnDeath(hitActionID);
                (e as EntityParent).stateFlag = Mogo.Util.Utils.BitSet((e as EntityParent).stateFlag, StateCfg.DEATH_STATE);
            }
        }
        //TriggerCombo(dummys.Count);a
    }
Example #6
0
    /// <summary>
    /// 过滤器,只返回bool值,一项为false则短路
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    bool Filter(int id)
    {
        if (!IsOpen)
        {
            return(false);
        }
        var guideLevel  = GuideXMLData.dataMap.Get(id).guideLevel;
        var playerLevel = MogoWorld.thePlayer.level;

        if (guideLevel != null && (playerLevel < guideLevel[0] || playerLevel > guideLevel[1]))
        {
            return(false);
        }
        var restriction = GuideXMLData.dataMap.Get(id).restriction;

        if (restriction != null)
        {
            foreach (var item in restriction)
            {
                var temp = CalculateDamage.GetProperty(MogoWorld.thePlayer, item.Key);
                if (temp != double.Parse(item.Value))
                {
                    return(false);
                }
            }
        }
        if (!MogoWorld.inCity)
        {
            return(false);
        }
        if (guideTimes.ContainsKey(id) && guideTimes[id] >= GuideXMLData.dataMap.Get(id).guideTimes)
        {
            return(false);
        }
        //MogoMsgBox.Instance.ShowFloatingText(String.Format("Guide {0} Activated", id));
        return(true);
    }
Example #7
0
 void Awake()
 {
     //Find and allocate the referenced objects and scripts in the scene
     _muzzleFlash   = gameObject.GetComponentInChildren <MuzzleFlash>();
     _midPoint      = GameObject.Find("MidPoint");
     _anim          = gameObject.GetComponent <Animator>();
     _agent         = gameObject.GetComponent <NavMeshAgent>();
     _obstacle      = gameObject.GetComponent <NavMeshObstacle>();
     _combatUI      = GameObject.Find("_combatMan").GetComponent <CombatUI>();
     _calcDam       = GameObject.Find("_combatMan").GetComponent <CalculateDamage>();
     _targetedEnemy = GameObject.Find("_combatMan").GetComponent <TargetedEnemy>();
     _moveIndicator = GameObject.Find("Player").GetComponent <MoveIndicator>();
     _playerTurnUI  = GameObject.Find("PlayerTurn");
     _cam           = GameObject.Find("_cameraParent").GetComponent <CameraController>();
     _combatOver    = GameObject.Find("EndCanvas").GetComponent <CombatOver>();
     _aux           = GameObject.Find("_combatMan").GetComponent <AuxilliaryPower>();
     //Determine player stats based off
     _ap = _CombatManager._maxAP;
     _combatUI.Initialize();
     //Prepare the elements used for navigation
     _mask = ~_mask;
     _path = new NavMeshPath();
     _aux.Initialize();
 }
Example #8
0
 void Start()
 {
     _hpBarGO            = transform.Find("HealthBar/Background").gameObject;
     _damageText         = transform.Find("HealthBar/DamageText").GetComponent <Text>();
     _damageText.enabled = false;
     _hpRect             = transform.Find("HealthBar/Background/HP").GetComponent <RectTransform>();
     _hpBarGO.SetActive(false);
     _muzzleFlash = gameObject.GetComponentInChildren <MuzzleFlash>();
     _anim        = gameObject.GetComponentInChildren <Animator>();
     _mask        = ~_mask;
     _midPoint    = GameObject.Find("MidPoint");
     _cam         = GameObject.Find("_cameraParent").GetComponent <CameraController>();
     _tM          = GameObject.Find("_combatMan").GetComponent <TurnManager>();
     _calcDam     = GameObject.Find("_combatMan").GetComponent <CalculateDamage>();
     _player      = GameObject.Find("Player").GetComponent <Transform>();
     _pT          = GameObject.Find("Player").GetComponent <PlayerTurn>();
     _playerAnim  = _player.GetComponent <Animator>();
     _agent       = transform.GetComponent <NavMeshAgent>();
     _obstacle    = transform.GetComponent <NavMeshObstacle>();
     transform.LookAt(_player);
     _currentHP = _maxHP;
     _meshTrans = gameObject.transform.FindChild("EnemyMesh").GetComponent <Transform>();
     _renderer  = _meshTrans.FindChild("Body").GetComponent <Renderer>();
 }
Example #9
0
 // Use this for initialization
 void Awake()
 {
     _calcDam      = GameObject.Find("_combatMan").GetComponent <CalculateDamage>();
     _text         = gameObject.GetComponent <Text>();
     _text.enabled = false;
 }