示例#1
0
 public void OnInteractionBegin(Interactor activator)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.BarrelInteraction::OnInteractionBegin(RoR2.Interactor)' called on client");
         return;
     }
     if (!this.opened)
     {
         this.Networkopened = true;
         EntityStateMachine component = base.GetComponent <EntityStateMachine>();
         if (component)
         {
             component.SetNextState(new Opening());
         }
         CharacterBody component2 = activator.GetComponent <CharacterBody>();
         if (component2)
         {
             TeamIndex objectTeam = TeamComponent.GetObjectTeam(component2.gameObject);
             TeamManager.instance.GiveTeamMoney(objectTeam, (uint)this.goldReward);
         }
         this.CoinDrop();
         ExperienceManager.instance.AwardExperience(base.transform.position, activator.GetComponent <CharacterBody>(), (ulong)this.expReward);
     }
 }
 // Token: 0x0600122B RID: 4651 RVA: 0x00059680 File Offset: 0x00057880
 public override void OnDeserialize(NetworkReader reader, bool initialState)
 {
     if (initialState)
     {
         for (int i = 0; i < this.stateMachines.Length; i++)
         {
             EntityStateMachine entityStateMachine = this.stateMachines[i];
             short stateTypeIndex = (short)reader.ReadPackedUInt32() - 1;
             if (!base.hasAuthority)
             {
                 EntityState entityState = EntityState.Instantiate(stateTypeIndex);
                 if (entityState != null)
                 {
                     entityState.OnDeserialize(reader);
                     if (!this.stateMachines[i])
                     {
                         Debug.LogErrorFormat("State machine [{0}] on object {1} is not set! incoming state = {2}", new object[]
                         {
                             i,
                             base.gameObject,
                             entityState.GetType()
                         });
                     }
                     entityStateMachine.SetNextState(entityState);
                 }
             }
         }
     }
 }
示例#3
0
        // Token: 0x06000A67 RID: 2663 RVA: 0x0002DACF File Offset: 0x0002BCCF
        private bool IsArmed()
        {
            EntityStateMachine  entityStateMachine  = this.armingStateMachine;
            BaseMineArmingState baseMineArmingState = ((entityStateMachine != null) ? entityStateMachine.state : null) as BaseMineArmingState;

            return(((baseMineArmingState != null) ? baseMineArmingState.damageScale : 0f) > 1f);
        }
        // Token: 0x0600122D RID: 4653 RVA: 0x000597DC File Offset: 0x000579DC
        public void SendSetEntityState(int stateMachineIndex)
        {
            if (!NetworkServer.active && !base.hasAuthority)
            {
                return;
            }
            NetworkWriter      networkWriter      = new NetworkWriter();
            EntityStateMachine entityStateMachine = this.stateMachines[stateMachineIndex];
            short value = StateIndexTable.TypeToIndex(entityStateMachine.state.GetType());

            networkWriter.StartMessage(48);
            networkWriter.Write(this.networkIdentity);
            networkWriter.Write((byte)stateMachineIndex);
            networkWriter.Write(value);
            entityStateMachine.state.OnSerialize(networkWriter);
            networkWriter.FinishMessage();
            if (NetworkServer.active)
            {
                NetworkServer.SendWriterToReady(base.gameObject, networkWriter, this.GetNetworkChannel());
                return;
            }
            if (ClientScene.readyConnection != null)
            {
                ClientScene.readyConnection.SendWriter(networkWriter, this.GetNetworkChannel());
            }
        }
        // Token: 0x06000B88 RID: 2952 RVA: 0x000325F0 File Offset: 0x000307F0
        private void AssignSkill(SkillDef newSkillDef)
        {
            this.skillDef = newSkillDef;
            if (this.skillDef == null)
            {
                return;
            }
            EntityStateMachine stateMachine = this.stateMachine;

            if (((stateMachine != null) ? stateMachine.customName : null) != this.skillDef.activationStateMachineName)
            {
                this.stateMachine = null;
                base.GetComponents <EntityStateMachine>(GenericSkill.stateMachineLookupBuffer);
                int i     = 0;
                int count = GenericSkill.stateMachineLookupBuffer.Count;
                while (i < count)
                {
                    EntityStateMachine entityStateMachine = GenericSkill.stateMachineLookupBuffer[i];
                    if (entityStateMachine.customName == this.skillDef.activationStateMachineName)
                    {
                        this.stateMachine = entityStateMachine;
                        break;
                    }
                    i++;
                }
            }
            if (this.skillDef.fullRestockOnAssign)
            {
                this.RecalculateMaxStock();
                this.stock = this.maxStock;
            }
            this.skillInstanceData = this.skillDef.OnAssigned(this);
            this.RecalculateFinalRechargeInterval();
        }
 // Token: 0x0600156B RID: 5483 RVA: 0x0005B61C File Offset: 0x0005981C
 public PassengerInfo(GameObject passengerBodyObject)
 {
     this.transform         = passengerBodyObject.transform;
     this.body              = passengerBodyObject.GetComponent <CharacterBody>();
     this.inputBank         = passengerBodyObject.GetComponent <InputBankTest>();
     this.interactionDriver = passengerBodyObject.GetComponent <InteractionDriver>();
     this.characterMotor    = passengerBodyObject.GetComponent <CharacterMotor>();
     this.networkIdentity   = passengerBodyObject.GetComponent <NetworkIdentity>();
     this.collider          = passengerBodyObject.GetComponent <Collider>();
     this.bodyStateMachine  = null;
     passengerBodyObject.GetComponents <EntityStateMachine>(VehicleSeat.PassengerInfo.sharedBuffer);
     for (int i = 0; i < VehicleSeat.PassengerInfo.sharedBuffer.Count; i++)
     {
         EntityStateMachine entityStateMachine = VehicleSeat.PassengerInfo.sharedBuffer[i];
         if (string.CompareOrdinal(entityStateMachine.customName, "Body") == 0)
         {
             this.bodyStateMachine = entityStateMachine;
             break;
         }
     }
     VehicleSeat.PassengerInfo.sharedBuffer.Clear();
     this.characterModel = null;
     if (this.body.modelLocator && this.body.modelLocator.modelTransform)
     {
         this.characterModel = this.body.modelLocator.modelTransform.GetComponent <CharacterModel>();
     }
 }
示例#7
0
        // Token: 0x06000A66 RID: 2662 RVA: 0x0002DA8C File Offset: 0x0002BC8C
        private void Start()
        {
            ProjectileGhostController component = base.GetComponent <ProjectileGhostController>();

            if (component)
            {
                this.projectileTransform = component.authorityTransform;
                this.armingStateMachine  = EntityStateMachine.FindByCustomName(this.projectileTransform.gameObject, "Arming");
            }
        }
 // Token: 0x0600122A RID: 4650 RVA: 0x0005962C File Offset: 0x0005782C
 public override bool OnSerialize(NetworkWriter writer, bool initialState)
 {
     if (initialState)
     {
         for (int i = 0; i < this.stateMachines.Length; i++)
         {
             EntityStateMachine entityStateMachine = this.stateMachines[i];
             writer.WritePackedUInt32((uint)(StateIndexTable.TypeToIndex(entityStateMachine.state.GetType()) + 1));
             entityStateMachine.state.OnSerialize(writer);
         }
         return(true);
     }
     return(false);
 }
示例#9
0
        public void Open()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::Open()' called on client");
                return;
            }
            EntityStateMachine component = base.GetComponent <EntityStateMachine>();

            if (component)
            {
                component.SetNextState(EntityState.Instantiate(this.openState));
            }
        }
示例#10
0
 // Token: 0x06000F3A RID: 3898 RVA: 0x0004B1E4 File Offset: 0x000493E4
 private void FindSourceStateMachine()
 {
     if (!this.characterModel || !this.characterModel.body)
     {
         return;
     }
     foreach (object obj in this.characterModel.body.transform)
     {
         EntityStateMachine component = ((Transform)obj).GetComponent <EntityStateMachine>();
         if (component && component.state is BaseHeadstompersState)
         {
             this.sourceStateMachine = component;
             break;
         }
     }
 }
        private void ReadyNextNullWard()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ArenaMissionController::ReadyNextNullWard()' called on client");
                return;
            }
            if (this.currentRound > this.nullWards.Length)
            {
                Debug.LogError("Out of null wards! Aborting.");
                return;
            }
            EntityStateMachine component = this.nullWards[this.currentRound].GetComponent <EntityStateMachine>();

            component.initialStateType = new SerializableEntityStateType(typeof(WardOnAndReady));
            component.SetNextState(new WardOnAndReady());
        }
        public static void HandleSetEntityState(NetworkMessage netMsg)
        {
            NetworkIdentity networkIdentity = netMsg.reader.ReadNetworkIdentity();
            byte            b = netMsg.reader.ReadByte();
            short           stateTypeIndex = netMsg.reader.ReadInt16();

            if (networkIdentity == null)
            {
                return;
            }
            NetworkStateMachine component = networkIdentity.gameObject.GetComponent <NetworkStateMachine>();

            if (component == null || (int)b >= component.stateMachines.Length)
            {
                return;
            }
            EntityStateMachine entityStateMachine = component.stateMachines[(int)b];

            if (entityStateMachine == null)
            {
                return;
            }
            if (networkIdentity.isServer)
            {
                HashSet <NetworkInstanceId> clientOwnedObjects = netMsg.conn.clientOwnedObjects;
                if (clientOwnedObjects == null || !clientOwnedObjects.Contains(networkIdentity.netId))
                {
                    return;
                }
            }
            else if (networkIdentity.hasAuthority)
            {
                return;
            }
            EntityState entityState = EntityState.Instantiate(stateTypeIndex);

            if (entityState == null)
            {
                return;
            }
            entityState.outer = entityStateMachine;
            entityState.OnDeserialize(netMsg.reader);
            entityStateMachine.SetState(entityState);
        }
示例#13
0
        // Token: 0x06000A80 RID: 2688 RVA: 0x0002DE84 File Offset: 0x0002C084
        public static EntityStateMachine FindByCustomName(GameObject gameObject, string customName)
        {
            List <EntityStateMachine> gameObjectComponents = GetComponentsCache <EntityStateMachine> .GetGameObjectComponents(gameObject);

            EntityStateMachine result = null;
            int i     = 0;
            int count = gameObjectComponents.Count;

            while (i < count)
            {
                if (string.CompareOrdinal(customName, gameObjectComponents[i].customName) == 0)
                {
                    result = gameObjectComponents[i];
                }
                i++;
            }
            GetComponentsCache <EntityStateMachine> .ReturnBuffer(gameObjectComponents);

            return(result);
        }
 // Token: 0x060005F5 RID: 1525 RVA: 0x00018903 File Offset: 0x00016B03
 private void Awake()
 {
     this.mainStateMachine = EntityStateMachine.FindByCustomName(base.gameObject, "Main");
     this.syncActiveMonsterBodies.InitializeBehaviour(this, ArenaMissionController.kListsyncActiveMonsterBodies);
     this.syncActivePickups.InitializeBehaviour(this, ArenaMissionController.kListsyncActivePickups);
 }