예제 #1
0
        //protected override void Awake()
        //{
        //    base.Awake();
        //}

        private void Start()
        {
            Debug.Log("Aim target start component");

            MessageBus.SendMessage(SubscribeType.Channel, GetComponent <Channel>().ChannelIds[SubscribeType.Channel],
                                   CommonMessage.Get(API.Messages.INSTANTIATED, ObjectData.GetObjectData(gameObject)));
        }
예제 #2
0
        private IEnumerator SendMsgs()
        {
            yield return(new WaitForEndOfFrame());

            MessageBus.SendMessage(SubscribeType.Channel, Channel.ChannelIds[SubscribeType.Channel], CommonMessage.Get(
                                       Inventory.API.Messages.CHECK_UPDATE), true);
            MessageBus.SendMessage(SubscribeType.Channel, Channel.ChannelIds[SubscribeType.Channel], CommonMessage.Get(
                                       AimTarget.API.Messages.UPDATE_SHOOT_POSITION_TRANSFORM,
                                       ObjectData.GetObjectData(ShootPosition)), true);
            MessageBus.SendMessage(SubscribeType.Channel, Channel.ChannelIds[SubscribeType.Channel], CommonMessage.Get(
                                       AimTarget.API.Messages.UPDATE_SPREAD_CONFIG,
                                       ObjectData.GetObjectData(SpreadConfig)), true);
        }
예제 #3
0
        private void InstantiateWeapon(Message msg)
        {
            Debug.Log("Create weapon!");

            var weaponData = msg.Data as WeaponInstantiateData;

            ServiceLocator.GetService <ResourceLoaderService>()
            .InstantiatePrefabByPathName("Weapons/" + weaponData.Type.ToString(),
                                         weapon =>
            {
                weapon.transform.parent           = weaponData.Parent;
                weapon.transform.localPosition    = new Vector3(0.001f, 0.079f, 0.025f);
                weapon.transform.localEulerAngles = new Vector3(94.46698f, 51.211f, 44.17799f);

                var sub     = weapon.GetComponent <SubscriberBehaviour>();
                var channel = weapon.GetComponent <Channel>();
                channel.ChannelIds.Add(SubscribeType.Channel, weaponData.ChannelId);
                sub.ReSubscribe();

                MessageBus.SendMessage(SubscribeType.Channel, weaponData.ChannelId,
                                       CommonMessage.Get(Characters.API.Messages.SET_ARMED));

                MessageBus.SendMessage(SubscribeType.Channel, weaponData.ChannelId,
                                       CommonMessage.Get(API.Messages.INSTANTIATED, ObjectData.GetObjectData(weapon)));

                if (!weaponData.CreateAimTarget)
                {
                    return;
                }

                MessageBus.SendMessage(SubscribeType.Channel, weaponData.ChannelId,
                                       CommonMessage.Get(AimTarget.API.Messages.HIDE));

                //MessageBus.SendMessage(CommonMessage.Get(
                //    AimTarget.API.Messages.INSTANTIATE,
                //        InstantiateData.GetInstantiateData(
                //            weapon.GetComponent<WeaponData>().WeaponConfig.aimTargetPrefab,
                //            weaponData.ChannelId)));
            });
        }
예제 #4
0
 private void OpenLootMenu(Message msg)
 {
     MessageBus.SendMessage(CommonMessage.Get(API.Messages.OPEN_LOOT_MENU,
                                              ObjectData.GetObjectData(LootItemsHolder)));
 }
예제 #5
0
 private void Ping(Message msg)
 {
     MessageBus.SendMessage(SubscribeType.Channel, Channel.ChannelIds[SubscribeType.Channel],
                            CommonMessage.Get(API.Messages.UPDATE,
                                              ObjectData.GetObjectData(_inventoryData)));
 }
예제 #6
0
 public void OnTriggerExit(Collider other)
 {
     MessageBus.SendMessage(SubscribeType.Channel, other.GetComponent <Channel>().ChannelIds[SubscribeType.Channel],
                            CommonMessage.Get(API.Messages.REMOVE_NEAR_OBJECT, ObjectData.GetObjectData(gameObject)));
 }