コード例 #1
0
    protected override void CopyTo(Action _destWarper)
    {
        ForceInteractionAction forceInteractionAction = _destWarper as ForceInteractionAction;

        forceInteractionAction.IsInteractionBroadcasted = IsInteractionBroadcasted;
        base.CopyTo(_destWarper);
    }
コード例 #2
0
        public void OnTriggerEnter(Collider collider)
        {
            if (interactRequest.Active)
            {
                return;
            }
            GameObject gameObject = ActionSequencer.FindActionGraphObject(collider.gameObject);

            if (gameObject != null && AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var _) && canInteractWithActionGraph(gameObject))
            {
                ForceInteractionAction component = gameObject.GetComponent <ForceInteractionAction>();
                if (component != null)
                {
                    currentActionGraphGameObject = gameObject;
                    interactRequest.Set();
                }
            }
        }
コード例 #3
0
        public void OnTriggerEnter(Collider collider)
        {
            GameObject gameObject = ActionSequencer.FindActionGraphObject(collider.gameObject);

            if (!AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var _) || !(gameObject != null) || !canInteractWithActionGraph(gameObject))
            {
                return;
            }
            ForceInteractionAction component = gameObject.GetComponent <ForceInteractionAction>();

            if (component != null)
            {
                ParticipationRequest.Type type    = ParticipationRequest.Type.ForcedInteraction;
                ParticipationRequest      request = new ParticipationRequest(type, gameObject, "PenguinInteraction");
                participationController.PrepareParticipation(request);
                if (participationData != null && participationData.ParticipatingGO != null && participationData.ParticipatingGO.Value == gameObject)
                {
                    participantReference         = participationData.ParticipatingGO;
                    currentActionGraphGameObject = gameObject;
                    interactRequest.Set();
                }
            }
            else
            {
                ParticipationRequest.Type type     = ParticipationRequest.Type.Prepare;
                ParticipationRequest      request2 = new ParticipationRequest(type, gameObject, "PenguinInteraction");
                if (!isReadyForParticipation)
                {
                    pendingParticipationRequest = request2;
                }
                else
                {
                    participationController.PrepareParticipation(request2);
                }
            }
        }
コード例 #4
0
    private void sendInteractionEvent(GameObject trigger)
    {
        ForceInteractionAction component = trigger.GetComponent <ForceInteractionAction>();

        if (component != null && !component.IsInteractionBroadcasted)
        {
            sendLocomotionUpdate(newSteerDirection, LocomotionAction.Move);
            return;
        }
        LocomotionActionEvent action = default(LocomotionActionEvent);

        action.Type     = LocomotionAction.Interact;
        action.Position = getCurrentPosition();
        ObjectType type = ObjectType.LOCAL;
        string     id   = trigger.GetPath();
        string     tag  = "";

        if (trigger.GetComponent <AvatarDataHandle>() != null)
        {
            type = ObjectType.PLAYER;
            id   = Service.Get <CPDataEntityCollection>().GetComponent <SessionIdData>(trigger.GetComponent <AvatarDataHandle>().Handle).SessionId.ToString();
            tag  = trigger.tag;
        }
        else if (trigger.GetComponent <NetworkObjectController>() != null)
        {
            CPMMOItemId itemId = trigger.GetComponent <NetworkObjectController>().ItemId;
            if (itemId.Parent == CPMMOItemId.CPMMOItemParent.WORLD)
            {
                type = ObjectType.SERVER;
            }
            id  = itemId.Id.ToString();
            tag = trigger.tag;
        }
        else
        {
            Transform parent = trigger.transform.parent;
            while (parent != null && parent.GetComponent <AvatarDataHandle>() == null)
            {
                parent = parent.transform.parent;
            }
            if (parent != null)
            {
                type = ObjectType.PLAYER;
                id   = Service.Get <CPDataEntityCollection>().GetComponent <SessionIdData>(parent.GetComponent <AvatarDataHandle>().Handle).SessionId.ToString();
                tag  = trigger.tag;
            }
            else if (trigger.transform.parent != null)
            {
                Collectible componentInChildren = trigger.transform.parent.gameObject.GetComponentInChildren <Collectible>();
                bool        flag = false;
                if (componentInChildren != null && componentInChildren.RewardDef != null)
                {
                    List <CollectibleRewardDefinition> definitions = componentInChildren.RewardDef.GetDefinitions <CollectibleRewardDefinition>();
                    if (definitions.Count > 0 && definitions[0].Collectible != null)
                    {
                        tag  = definitions[0].Collectible.CollectibleType;
                        flag = true;
                    }
                }
                if (!flag)
                {
                    tag = trigger.tag;
                }
            }
            else
            {
                tag = trigger.tag;
            }
        }
        action.Object = new ActionedObject(type, id, tag);
        if (broadcastingDisabledEvents == 0)
        {
            networkService.PlayerActionService.LocomotionAction(action);
        }
    }
コード例 #5
0
 public override void AssignPointsToCompetitors(List <Competitor <GameObject> > competitors)
 {
     for (int i = 0; i < competitors.Count; i++)
     {
         Competitor <GameObject> competitor = competitors[i];
         if (competitor.Value.IsDestroyed())
         {
             competitor.Points = 0;
             continue;
         }
         FilterTriggerAction component = competitor.Value.GetComponent <FilterTriggerAction>();
         if (component != null && !checkCanInteractWithFilter(competitor.Value, component))
         {
             competitor.Points = 0;
             continue;
         }
         ForceInteractionAction component2 = competitor.Value.GetComponent <ForceInteractionAction>();
         if (component2 != null)
         {
             competitor.Points = 100;
             continue;
         }
         InteractionIdentifier component3 = competitor.Value.GetComponent <InteractionIdentifier>();
         if (component3 != null)
         {
             competitor.Points = getScoreFromInteractionIdentifier(component3);
             continue;
         }
         GameObject gameObject = null;
         if (DataEntityCollection.TryGetComponent <GameObjectReferenceData>(PlayerHandle, out var component4))
         {
             gameObject = component4.GameObject;
         }
         bool flag  = participation.ParticipatingGO == competitor && participation.CurrentParticipationState == ParticipationState.Participating;
         bool flag2 = competitor.Value.GetComponent <PropExperience>() != null && gameObject != null && !gameObject.IsDestroyed() && competitor.Value.transform.root == gameObject.transform;
         if (flag || flag2)
         {
             competitor.Points = 95;
             continue;
         }
         bool flag3 = competitor.Value.GetComponent <Prop>() != null;
         bool flag4 = competitor.Value.GetComponent <SendQuestEvent>() != null;
         bool flag5 = competitor.Value.GetComponent <Action>() != null;
         bool flag6 = competitor.Value.GetComponent <PropExperience>() != null;
         if (flag3)
         {
             competitor.Points = 94;
         }
         if (flag4)
         {
             competitor.Points = 80;
         }
         if (flag5)
         {
             competitor.Points = 70;
         }
         if (flag6)
         {
             competitor.Points = 60;
         }
     }
 }