예제 #1
0
        public void Resign()
        {
            var action = new ResignAction()
            {
                SessionID = GameManager.instance.currentSession,
            };

            ProcessAction(action);
        }
        /// <summary>
        /// Resigns from the currently joined federation execution.
        /// </summary>
        /// <param name="resignAction">the action to take upon resigning
        /// </param>
        /// <exception cref="OwnershipAcquisitionPending"> if an ownership acquisition operation is
        /// pending
        /// </exception>
        /// <exception cref="FederateOwnsAttributes"> if the federate still owns attributes
        /// </exception>
        /// <exception cref="FederateNotExecutionMember"> if the federate is not a member of an execution
        /// </exception>
        /// <exception cref="RTIinternalError"> if an internal error occurred in the
        /// run-time infrastructure
        /// </exception>
        public void ResignFederationExecution(ResignAction resignAction)
        {
            // Removes the federate to the execution
            federationsMap[this.federationName].HLAfederatesinFederation.Remove(Federate.HLAfederateHandle);

            // Resigns to the execution
            ((Sxtafederate)this.federate).HLAisJoined = false;

            // Removes reference to current federate
            HLAobjectRoot.DefaultFederate                  = null;
            HLAobjectRoot.DefaultFederateAmbassador        = metaFederateAmbassador;
            HLAobjectRoot.DefaultFederationExecutionHandle = -1;

            this.federate = null;
            this.state    = null;
            this.lrc      = null;

            if (resignAction == ResignAction.DELETE_OBJECTS)
            {
                throw new Exception("The method or operation is not implemented.");
            }
            else if (resignAction == ResignAction.DELETE_OBJECTS_THEN_DIVEST)
            {
                throw new Exception("The method or operation is not implemented.");
            }
            else if (resignAction == ResignAction.CANCEL_PENDING_OWNERSHIP_ACQUISITIONS)
            {
                throw new Exception("The method or operation is not implemented.");
            }
            else if (resignAction == ResignAction.CANCEL_THEN_DELETE_THEN_DIVEST)
            {
                throw new Exception("The method or operation is not implemented.");
            }
            else if (resignAction == ResignAction.UNCONDITIONALLY_DIVEST_ATTRIBUTES)
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }