public sealed override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
        {
            EntityStateMachine reloadTargetStatemachine = null;

            EntityStateMachine[] stateMachines = skillSlot.GetComponents <EntityStateMachine>();
            for (Int32 i = 0; i < stateMachines.Length; ++i)
            {
                EntityStateMachine mach = stateMachines[i];
                if (mach.customName == this.reloadStateMachineName)
                {
                    reloadTargetStatemachine = mach;
                }
            }

#if ASSERT
            if (reloadTargetStatemachine == null)
            {
                Log.Error("No state machine found for reload");
            }
#endif

            skillSlot.stock = this.actualMaxStock;

            return(new SniperPrimaryInstanceData(this, reloadTargetStatemachine, this.reloadParams, skillSlot));
        }
Exemplo n.º 2
0
        public override void OnUnassigned([NotNull] GenericSkill skillSlot)
        {
            if (skillSlot && skillSlot.characterBody && skillSlot.characterBody.modelLocator && skillSlot.characterBody.modelLocator.modelTransform)
            {
                this.applyVisuals?.Invoke(skillSlot.characterBody.modelLocator.modelTransform.GetComponent <CharacterModel>());
            }

            EntityStateMachine[] stateMachines = skillSlot.GetComponents <EntityStateMachine>();
            foreach (StateMachineDefaults def in this.stateMachineDefaults)
            {
                foreach (EntityStateMachine mach in stateMachines)
                {
                    if (mach.customName == def.machineName)
                    {
                        mach.initialStateType = def.defaultInitalState;
                        mach.mainStateType    = def.defaultMainState;

                        if (mach.state.GetType() == def.mainState.stateType)
                        {
                            //mach.SetNextState( EntityStates.EntityState.Instantiate( def.defaultMainState ) );
                        }

                        break;
                    }
                }
            }

            base.OnUnassigned(skillSlot);
        }
Exemplo n.º 3
0
            internal ReactivationInstanceData(ReactivatedSkillDef <TSkillData> def, GenericSkill skillSlot)
            {
                this.def = def;
                this.waitingOnReactivation = false;
                this.skillSlot             = skillSlot;
                this.reactivationTimer     = 0f;
                EntityStateMachine[] machs = skillSlot.GetComponents <EntityStateMachine>();
                for (Int32 i = 0; i < machs.Length; ++i)
                {
                    EntityStateMachine mach = machs[i];
                    if (mach.customName == def.reactivationStateMachineName)
                    {
                        this.reactivationStateMachine = mach;
                        break;
                    }
                }
#if ASSERT
                if (this.reactivationStateMachine == null)
                {
                    Log.Error("No matching statemachine found");
                }
#endif
            }