public void Awake()
 {
     _playerInfoBlackBoard      = SceneBlackBoard.getInstance().getBlackBoard <PlayerInfoBlackBoard>();
     _animatorComponent         = GetComponent <Animator>();
     _moveAndRotationComponent  = GetComponent <AIPlayerMoveAndRotation>();
     _palyerBattleUnitComponent = GetComponent <AIBattleUnit>();
 }
        public void doAttack(AIBattleUnit target)
        {
            _animatorComponent.SetFloat("OnAttack", 1f);

            //_moveAndRotationComponent.keepLookAt( target.transform );

            _palyerBattleUnitComponent.attack(target);
        }
        private AIBattleUnit getCurrSelectBattleUnit(object paramsObj)
        {
            AIBattleUnit selectBattleUnit = paramsObj as AIBattleUnit;

            if (selectBattleUnit == null)
            {
                selectBattleUnit = _playerInfoBlackBoard.currSelectBattleUnit;
            }

            return(selectBattleUnit);
        }
Beispiel #4
0
        protected override void actionStart()
        {
            GameObject   playerGo         = playerInfoBB.getCurrleadGo();
            AIBattleUnit playerBattleUnit = playerGo.GetComponent <AIBattleUnit>();

            if (playerBattleUnit == playerInfoBB.currSelectBattleUnit)
            {
                playerInfoBB.getSelectBattleUnitLocaltionMaskGo().SetActive(false);
                sendFSMEvent(FSMEventsBlackBoard.FSM_SELECT_SELF);
            }
            else
            {
                GameObject selectBattleUnitLocaltionMaskGo = playerInfoBB.getSelectBattleUnitLocaltionMaskGo();
                selectBattleUnitLocaltionMaskGo.transform.SetParent(playerInfoBB.currSelectBattleUnit.transform);
                selectBattleUnitLocaltionMaskGo.transform.localPosition = Vector3.zero;
                selectBattleUnitLocaltionMaskGo.SetActive(true);
                doNextActionState();
            }
        }
Beispiel #5
0
        private void doProcessClicked(RaycastHit raycastHit)
        {
            playerInfoBB.currClickedRaycastHit = raycastHit;

            //  点击的是地板
            if (raycastHit.collider.name == _gameConfigVo.playerMovementFloor)
            {
                sendFSMEvent(FSMEventsBlackBoard.FSM_JUST_MOVE);
            }
            else
            {
                Debug.Log(playerInfoBB.getCurrleadGo().name);
                Debug.Log(raycastHit.collider.gameObject.name);

                //  选择的是自己
                if (playerInfoBB.getCurrleadGo() == raycastHit.collider.gameObject)
                {
                    sendFSMEvent(FSMEventsBlackBoard.FSM_SELECT_SELF);
                }
                else
                {
                    //  选择了另一个可以控制的对象
                    PlayerUnitManager pum = raycastHit.collider.GetComponent <PlayerUnitManager>();
                    if (pum != null)
                    {
                        playerInfoBB.setCurrLeadGo(raycastHit.collider.gameObject);

                        sendFSMEvent(FSMEventsBlackBoard.FSM_LEAD_CHANGED);
                    }
                }



                //  点击的那个对象是否是 作战单位
                AIBattleUnit battleUnit = raycastHit.collider.gameObject.GetComponent <AIBattleUnit>();

                if (battleUnit != null)
                {
                    playerInfoBB.currSelectBattleUnit = battleUnit;
                }
            }
        }
        public void receivedMessage(ObserverMsgTypeEnum messageType, object paramsObj, PublisheOptionVo options)
        {
            switch (messageType)
            {
            case ObserverMsgTypeEnum.PLAYER_START_TO_MOVE_BY_CLICK_GROUND:
            {
                _animatorComponent.SetFloat("OnAttack", 0f);

                //  如果之前有选中可攻击的作战单位,把选中的 maskGo Active设置 false
                _playerInfoBlackBoard.getSelectBattleUnitLocaltionMaskGo().SetActive(false);


                //  告诉移动组建,开始移动
                RaycastHit raycastHit = (RaycastHit)paramsObj;
                this.doMoveToByPosition(raycastHit.point);

                break;
            }

            case ObserverMsgTypeEnum.PLAYER_START_ATTACK:
            {
                AIBattleUnit selectBattleUnit = this.getCurrSelectBattleUnit(paramsObj);

                if (_palyerBattleUnitComponent.gameObject != _playerInfoBlackBoard.getCurrleadGo())
                {
                    throw new Exception("PlayerUnitManager 只能添加到主角身上");
                }

                //  如果攻击的不是自己
                if (_palyerBattleUnitComponent != selectBattleUnit)
                {
                    _palyerBattleUnitComponent.attack(selectBattleUnit);
                }

                break;
            }
            }
        }
Beispiel #7
0
        protected override void actionStart()
        {
            AIBattleUnit target = _playerInfoBB.currSelectBattleUnit;

            _pum.doAttack(target);
        }
Beispiel #8
0
 public CollisionRefereeVo(AIBattleUnit from, AIBattleUnit target)
 {
     this.from   = from;
     this.target = target;
 }
Beispiel #9
0
        //  ===========================================================================

        public void attack(AIBattleUnit targetBattleUnit)
        {
        }