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

            //_moveAndRotationComponent.keepLookAt( target.transform );

            _palyerBattleUnitComponent.attack(target);
        }
コード例 #3
0
        private AIBattleUnit getCurrSelectBattleUnit(object paramsObj)
        {
            AIBattleUnit selectBattleUnit = paramsObj as AIBattleUnit;

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

            return(selectBattleUnit);
        }
コード例 #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();
            }
        }
コード例 #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;
                }
            }
        }
コード例 #6
0
        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;
            }
            }
        }
コード例 #7
0
        protected override void actionStart()
        {
            AIBattleUnit target = _playerInfoBB.currSelectBattleUnit;

            _pum.doAttack(target);
        }
コード例 #8
0
ファイル: AIBattleUnit.cs プロジェクト: futurekey/UnityZMC
 public CollisionRefereeVo(AIBattleUnit from, AIBattleUnit target)
 {
     this.from   = from;
     this.target = target;
 }
コード例 #9
0
ファイル: AIBattleUnit.cs プロジェクト: futurekey/UnityZMC
        //  ===========================================================================

        public void attack(AIBattleUnit targetBattleUnit)
        {
        }