public GOActionController(GameObjectController gameObjectController)
 {
     _gameObjectController = gameObjectController;
     isNetObj = gameObjectController.baseAttribute.isNetObj;
     InitActionData();
     InitAction();
 }
示例#2
0
        protected virtual void addObj(GameObject obj, GameObjectInfo info)
        {
            obj.transform.parent = _parent.transform;
            obj.GetComponent <BaseAttributes>().objectId = info.objectId;
            obj.GetComponent <BaseAttributes>().aoId     = info.aoId;
            obj.GetComponent <BaseAttributes>().groupId  = info.groupId;
            obj.GetComponent <BaseAttributes>().isNetObj = info.isNetObj;
            GameObjectController controller = obj.GetComponent <GameObjectController>();

            controller.InitControllerInfo();
            _listObj.Add(obj);
            _mapObj.Add(info.aoId, obj);

            //将对象添加到对应的区块位置中
            controller.On_ChangeChunk += HandleOn_ChangeChunk;
            List <GameObject> list;
            WorldPos          pos = controller.gameObjectState.attachChunk.worldPos;

            _mapChunkPosObj.TryGetValue(pos, out list);
            if (list == null)
            {
                list = new List <GameObject>();
                _mapChunkPosObj.Add(pos, list);
            }
            list.Add(obj);
        }
示例#3
0
        public override void ClientDo(ServerConnectionWorker connectionWork)
        {
            GameObject player = HasActionObjectManager.Instance.playerManager.getObjById(aoId);

            //做动作的时候,可能还没有真正实例化出来
            if (player == null)
            {
                return;
            }

            GameObjectController controller = player.GetComponent <GameObjectController>();

//			if(!controller.IsRead)return;
            player.transform.localRotation = Quaternion.AngleAxis(yRotate, Vector3.up);
            controller.Move(direction);
            if (isJump)
            {
                controller.Jump();
            }
            else
            {
                controller.StopJump();
            }
            controller.DoAction(actionId);
        }
示例#4
0
        public override void ClientDo(ServerConnectionWorker connectionWork)
        {
            GameObject monster = HasActionObjectManager.Instance.monsterManager.getObjById(aoId);

            //做动作的时候,可能还没有真正实例化出来
            if (monster == null)
            {
                return;
            }
            monster.transform.localRotation = Quaternion.AngleAxis(yRotate, Vector3.up);
            GameObjectController controller = monster.GetComponent <GameObjectController>();

            if (controller.baseAttribute.isNetObj)
            {
                controller.Move(direction);
                if (isJump)
                {
                    controller.Jump();
                }
                else
                {
                    controller.StopJump();
                }
                controller.DoAction(actionId);
            }
        }
//		void Awake()
//		{
//			_motor = GetComponent<CharacterMotor>();
//			_gameObjectController = GetComponent<GameObjectController>();
//			_map = new Dictionary<MovableConditionType, MovableCondition>();
//			InitMovableCondition();
//		}

        public void InitControllerInfo()
        {
            _motor = GetComponent <CharacterMotor>();
            _gameObjectController = GetComponent <GameObjectController>();
            _map = new Dictionary <MovableConditionType, MovableCondition>();
            InitMovableCondition();
            inited = true;
        }
示例#6
0
 public virtual void attach(GameObject haveActionObj)
 {
     this._host = haveActionObj;
     if (_searchComponent != null)
     {
         _searchComponent.dispose();
     }
     _hostController = this._host.GetComponent <GameObjectController>();
     initAIData();
 }
示例#7
0
        public static BaseActionScript GetActionScript(string name, GameObjectController gameObjectController)
        {
            string className = "MTB." + name;
            Type   t         = Type.GetType(className);

            if (t == null)
            {
                throw new Exception("不存在名字为:" + name + "的ActionScript");
            }
            return(Activator.CreateInstance(t, new object[] { gameObjectController }) as BaseActionScript);
        }
        public FlashActionScript(GameObjectController gameObjectController)
            : base(gameObjectController)
        {
            GameObject particlePrefab = ResourceManager.Instance.LoadAsset <GameObject>(PARTICLE_PATH) as GameObject;
            GameObject go             = GameObject.Instantiate(particlePrefab) as GameObject;

            go.transform.parent        = _gameObjectController.transform;
            go.transform.localPosition = Vector3.zero;
            particle = go.GetComponentInChildren <ParticleSystem>();
            particle.Stop();
        }
示例#9
0
        public override void removeObj(GameObject obj)
        {
            base.removeObj(obj);
            GameObjectController controller     = obj.GetComponent <GameObjectController>();
            GameObjectController mainController = _mainPlayer.GetComponent <GameObjectController>();

            if (controller.baseAttribute.aoId == mainController.baseAttribute.aoId)
            {
                _mainPlayer = null;
            }
        }
 // Use this for initialization
 void Start()
 {
     _controller = gameObject.GetComponent <GameObjectController>();
     AddEventListener();
     if (_lookObj == null)
     {
         _lookObj                  = new GameObject();
         _lookObj.name             = "lookObj";
         _lookObj.transform.parent = gameObject.transform;
     }
     _movespeed = DataManagerM.Instance.getMonsterDataManager().getAIData(gameObject).moveSpeed;
 }
示例#11
0
        public GameObjectState(GameObjectController controller)
        {
            _controller = controller;
            _curPos     = Terrain.GetWorldPos(_controller.transform.position);
            CheckAndResetPos();
            Chunk chunk = World.world.GetChunk(_curPos.x, 0, _curPos.z);

            AttachChunk(chunk);
            WorldPos chunkPos = chunk.worldPos;

            _inBlock         = _attachChunk.GetBlock(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y, _curPos.z - chunkPos.z, true);
            _standBlock      = _attachChunk.GetBlock(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y - 1, _curPos.z - chunkPos.z, true);
            _blockLightLevel = _attachChunk.GetBlockLight(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y, _curPos.z - chunkPos.z, true);
            _sunLightLevel   = _attachChunk.GetSunLight(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y, _curPos.z - chunkPos.z, true);
            InitRenderLight(_blockLightLevel, _sunLightLevel);
        }
示例#12
0
        public override void ActionIn()
        {
            RaycastHit hit;

            var startPosition = _gameObjectController.transform.position + startOffset;
            var direction     = _gameObjectController.transform.forward;

            if (Physics.Raycast(startPosition, direction, out hit, distance, maskLayer))
            {
                GameObjectController controller = hit.collider.GetComponent <GameObjectController>();
                if (controller == null)
                {
                    return;
                }
                controller.BeAttack(new BeAttackParam(direction));
            }
        }
示例#13
0
        public override void ActionIn()
        {
            float      screenX = _playerController.playerInputState.X;
            float      screenY = _playerController.playerInputState.Y;
            RaycastHit hit;
            Ray        ray = CameraManager.Instance.CurCamera.followCamera.ScreenPointToRay(new Vector3(screenX, screenY, 0));

            bool IsHit = Physics.Raycast(ray.origin, ray.direction, out hit, rayDistance, maskLayer);

            if (IsHit && Vector3.Distance(_playerController.transform.position, hit.point)
                < distance)
            {
                GameObjectController controller = hit.collider.GetComponent <GameObjectController>();
                if (controller == null)
                {
                    return;
                }
                controller.BeAttack(new BeAttackParam(ray.direction));
            }
        }
示例#14
0
        public virtual void removeObj(GameObject obj)
        {
            _listObj.Remove(obj);
            GameObjectController controller = obj.GetComponent <GameObjectController>();

            _mapObj.Remove(controller.baseAttribute.aoId);
            controller.On_ChangeChunk -= HandleOn_ChangeChunk;
            List <GameObject> list;
            WorldPos          pos = controller.gameObjectState.attachChunk.worldPos;

            _mapChunkPosObj.TryGetValue(pos, out list);
            if (list != null)
            {
                list.Remove(obj);
                if (list.Count <= 0)
                {
                    _mapChunkPosObj.Remove(pos);
                }
            }
            obj.SetActive(false);
            SelfDestroy.Destroy(obj);
        }
示例#15
0
        void HandleOn_ChangeChunk(GameObjectController controller, Chunk oldChunk, Chunk newChunk)
        {
            List <GameObject> list;

            _mapChunkPosObj.TryGetValue(oldChunk.worldPos, out list);
            if (list != null)
            {
                list.Remove(controller.gameObject);
                if (list.Count <= 0)
                {
                    _mapChunkPosObj.Remove(oldChunk.worldPos);
                }
                list = null;
                _mapChunkPosObj.TryGetValue(newChunk.worldPos, out list);
                if (list == null)
                {
                    list = new List <GameObject>();
                    _mapChunkPosObj.Add(newChunk.worldPos, list);
                }
                list.Add(controller.gameObject);
            }
        }
 public BaseInputConditionScript(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }
 public ActionCancelConditionScript(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }
 public GOPlayerActionController(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }
 public ActionRevertInputConditionScript(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }
示例#20
0
 public virtual void Dispose()
 {
     _gameObjectController = null;
 }
示例#21
0
 public GONpcActionController(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }
示例#22
0
 public StateConditionScript(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }
 public GOMonsterActionController(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }
示例#24
0
 public ScreenDigActionScript(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
     _playerController = gameObjectController as GOPlayerController;
 }
示例#25
0
 public BaseScript(GameObjectController gameObjectController)
 {
     _gameObjectController = gameObjectController;
 }
示例#26
0
 public ScreenRayInputConditionScript(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
     _playerController = gameObjectController as GOPlayerController;
 }
示例#27
0
 public GameObjectInputState(GameObjectController controller)
 {
     _moveDirection = Vector2.zero;
     _jump          = false;
     _controller    = controller;
 }
 public PlayerInputState(GameObjectController controller)
     : base(controller)
 {
     _inputActionType = InputActionType.Null;
 }
 public PlayerState(GameObjectController controller)
     : base(controller)
 {
 }
示例#30
0
 public RayAttackActionScript(GameObjectController gameObjectController)
     : base(gameObjectController)
 {
 }