Exemple #1
0
        public void OnActionAborted(GameObject owner, ClubPenguin.Actions.Action action)
        {
            State state = null;

            if (owner != null)
            {
                int instanceID = owner.GetInstanceID();
                if (sequencerDict.ContainsKey(instanceID))
                {
                    state = sequencerDict[instanceID];
                }
            }
            else
            {
                for (int i = 0; i < sequencerList.Count; i++)
                {
                    State state2 = sequencerList[i];
                    if (state2 != null && state2.Actions.Contains(action))
                    {
                        state = state2;
                        break;
                    }
                }
            }
            if (state != null)
            {
                abortSequence(state);
            }
        }
    protected override void CopyTo(ClubPenguin.Actions.Action _showPopup)
    {
        CreateCameraSpacePopupAction createCameraSpacePopupAction = _showPopup as CreateCameraSpacePopupAction;

        createCameraSpacePopupAction.PopupContentPath = PopupContentPath;
        base.CopyTo(_showPopup);
    }
    protected override void CopyTo(ClubPenguin.Actions.Action _destAction)
    {
        WarpTunnelAction warpTunnelAction = _destAction as WarpTunnelAction;

        warpTunnelAction.Waypoints             = Waypoints;
        warpTunnelAction.EnterAnimTrigger      = EnterAnimTrigger;
        warpTunnelAction.ExitAnimTrigger       = ExitAnimTrigger;
        warpTunnelAction.StopAtEndPoint        = StopAtEndPoint;
        warpTunnelAction.SnapToStart           = SnapToStart;
        warpTunnelAction.StartAccel            = StartAccel;
        warpTunnelAction.TravelDelay           = TravelDelay;
        warpTunnelAction.TravelStartSpeed      = TravelStartSpeed;
        warpTunnelAction.TravelSpeed           = TravelSpeed;
        warpTunnelAction.TravelAccelCurve      = TravelAccelCurve;
        warpTunnelAction.TurnSmoothing         = TurnSmoothing;
        warpTunnelAction.Curvature             = Curvature;
        warpTunnelAction.Steps                 = Steps;
        warpTunnelAction.UseWorldUp            = UseWorldUp;
        warpTunnelAction.Is3DSpace             = Is3DSpace;
        warpTunnelAction.FakeVehicle           = FakeVehicle;
        warpTunnelAction.VehiclePrefab         = VehiclePrefab;
        warpTunnelAction.VehicleSpawnTransform = VehicleSpawnTransform;
        warpTunnelAction.SeatName              = SeatName;
        warpTunnelAction.IsChatEnabled         = IsChatEnabled;
        base.CopyTo(_destAction);
    }
Exemple #4
0
        public void ActionCompleted(GameObject owner, ClubPenguin.Actions.Action action, object userData = null, bool conditionBranchValue = true)
        {
            if (owner == null)
            {
                Log.LogErrorFormatted(this, "Owner is null when an action is complete. Action = {0}, UserData = {1}", action, userData);
                OnActionAborted(owner, action);
                return;
            }
            int instanceID = owner.GetInstanceID();

            if (!sequencerDict.ContainsKey(instanceID))
            {
                return;
            }
            State state = sequencerDict[instanceID];
            bool  flag  = false;

            if (action.EndAllOnExit)
            {
                destroyAllActions(state);
            }
            else
            {
                triggerInterrupts(state, action);
                if (enableDependentActions(state, action, userData, conditionBranchValue))
                {
                    state.Actions.Remove(action);
                    UnityEngine.Object.Destroy(action);
                    if (state.Actions.Count > 0)
                    {
                        bool flag2 = false;
                        int  count = state.Actions.Count;
                        for (int i = 0; i < count; i++)
                        {
                            if (state.Actions[i].enabled)
                            {
                                flag2 = true;
                                break;
                            }
                        }
                        if (!flag2)
                        {
                            destroyAllActions(state);
                        }
                    }
                }
                else
                {
                    flag = true;
                }
            }
            if (flag)
            {
                abortSequence(state);
            }
            else if (state.Actions.Count == 0)
            {
                CompleteAndRemoveSequence(state);
            }
        }
Exemple #5
0
    protected override void CopyTo(ClubPenguin.Actions.Action _dest)
    {
        EndMascotInteractionAction endMascotInteractionAction = _dest as EndMascotInteractionAction;

        endMascotInteractionAction.Controller = Controller;
        endMascotInteractionAction.ScreenName = ScreenName;
        base.CopyTo(_dest);
    }
    protected override void CopyTo(ClubPenguin.Actions.Action _dest)
    {
        StartMascotInteractionAction startMascotInteractionAction = _dest as StartMascotInteractionAction;

        startMascotInteractionAction.Controller      = Controller;
        startMascotInteractionAction.TrayClosed      = TrayClosed;
        startMascotInteractionAction.MainNavDisabled = MainNavDisabled;
        base.CopyTo(_dest);
    }
Exemple #7
0
    protected override void CopyTo(ClubPenguin.Actions.Action _destWarper)
    {
        EquipItemAction equipItemAction = _destWarper as EquipItemAction;

        equipItemAction.TargetBoneName    = TargetBoneName;
        equipItemAction.ItemPrefab        = ItemPrefab;
        equipItemAction.StoreExistingProp = StoreExistingProp;
        base.CopyTo(_destWarper);
    }
Exemple #8
0
        private void enableRootActions(State state)
        {
            int count = state.Actions.Count;

            for (int i = 0; i < count; i++)
            {
                ClubPenguin.Actions.Action action = state.Actions[i];
                if (action.ParentId == -1 && action.ParentIdOnFalse == -1)
                {
                    action.enabled = true;
                }
            }
        }
Exemple #9
0
        private void triggerInterrupts(State state, ClubPenguin.Actions.Action completedAction)
        {
            int id    = completedAction.Id;
            int count = state.Actions.Count;

            ClubPenguin.Actions.Action[] array = new ClubPenguin.Actions.Action[count];
            int num = 0;

            for (int i = 0; i < count; i++)
            {
                ClubPenguin.Actions.Action action = state.Actions[i];
                if (action.InterruptedBy == id && !action.Complete)
                {
                    array[num] = action;
                    num++;
                }
            }
            for (int i = 0; i < num; i++)
            {
                array[i].Completed();
            }
        }
Exemple #10
0
        private bool enableDependentActions(State state, ClubPenguin.Actions.Action completedAction, object userData = null, bool conditionBranchValue = true)
        {
            int  id     = completedAction.Id;
            int  count  = state.Actions.Count;
            bool result = true;

            for (int i = 0; i < count; i++)
            {
                ClubPenguin.Actions.Action action = state.Actions[i];
                if (action == null)
                {
                    result = false;
                    break;
                }
                int num = (conditionBranchValue ? action.ParentId : action.ParentIdOnFalse);
                if (num == id)
                {
                    action.IncomingUserData = userData;
                    action.enabled          = true;
                }
            }
            return(result);
        }
Exemple #11
0
 protected override void CopyTo(ClubPenguin.Actions.Action _destAction)
 {
     base.CopyTo(_destAction);
 }
Exemple #12
0
        public bool StartSequence(GameObject owner, GameObject trigger)
        {
            bool result = false;

            if (owner == null)
            {
                Log.LogErrorFormatted(this, "owner is null when starting a sequence for trigger {0}", trigger);
                return(result);
            }
            int instanceID = owner.GetInstanceID();

            if (sequencerDict.ContainsKey(instanceID))
            {
                State state = sequencerDict[instanceID];
                if (!state.Trigger.IsDestroyed())
                {
                }
            }
            else
            {
                ClubPenguin.Actions.Action[] components = trigger.GetComponents <ClubPenguin.Actions.Action>();
                if (components.Length > 0)
                {
                    SharedActionGraphState sharedActionGraphState = trigger.GetComponent <SharedActionGraphState>();
                    if (sharedActionGraphState == null)
                    {
                        sharedActionGraphState = trigger.AddComponent <SharedActionGraphState>();
                    }
                    if (sharedActionGraphState.MaxInteractors > -1 && sharedActionGraphState.Interactors.Count >= sharedActionGraphState.MaxInteractors)
                    {
                        result = false;
                    }
                    else
                    {
                        State state2 = new State(owner, trigger);
                        int   num    = components.Length;
                        state2.Actions.Capacity = num;
                        for (int i = 0; i < num; i++)
                        {
                            GameObject gameObject = components[i].GetTarget();
                            if (gameObject == null)
                            {
                                gameObject = owner;
                            }
                            if (!gameObject.IsDestroyed())
                            {
                                if (state2.Targets.Add(gameObject))
                                {
                                    sequenceStarted(state2);
                                }
                                ClubPenguin.Actions.Action action = components[i].AddToGameObject(gameObject);
                                action.Owner = owner;
                                state2.Actions.Add(action);
                            }
                        }
                        addSequencer(owner, state2);
                        enableRootActions(state2);
                        result = true;
                        if (owner.CompareTag("Player"))
                        {
                            Service.Get <EventDispatcher>().DispatchEvent(new ActionSequencerEvents.ActionSequenceStarted(trigger));
                        }
                    }
                }
            }
            return(result);
        }