private void FinalizeTargetHijacked(Transform target)
    {
        AIEntity component = target.GetComponent <AIEntity>();

        if (base.isServer)
        {
            component.Hijack(this.m_AIEntity, false);

            var   field = typeof(ModdedAbilityHijack_old).BaseType.GetField("m_HijackedAbilityIDs", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
            int[] hijackedAbilityIDs = (int[])field.GetValue(this);

            foreach (int num in hijackedAbilityIDs)
            {
                if (component.GetAbilities().CanAddAbility(num))
                {
                    component.ServerAddAbility(num);
                }
            }
        }
        component.m_Locomotion.AddWalkableLayer(NavMeshLayers.JustAgents);
        component.RegisterEventCallback(AIEventNotification.Killed, new AIEntityEvent(this.NotifyDeath));
        component.RegisterEventCallback(AIEventNotification.Bribed, new AIEntityEvent(this.NotifyDeath));
        component.RegisterEventCallback(AIEventNotification.Despawn, new AIEntityEvent(this.NotifyDeath));
        component.RegisterEventCallback(AIEventNotification.Unhijacked, new AIEntityEvent(this.NotifyDeath));
        this.UpdateEnergyRegen();
        // TODO
        ModdedAbilityHijack.HijackedEntities.Add(component);
    }
示例#2
0
    private void FinalizeTargetHijacked(Transform target)
    {
        AIEntity component = target.GetComponent <AIEntity>();

        if (base.isServer)
        {
            component.Hijack(this.m_AIEntity, false);
            foreach (int num in this.m_HijackedAbilityIDs)
            {
                if (component.GetAbilities().CanAddAbility(num))
                {
                    component.ServerAddAbility(num);
                }
            }
        }
        component.m_Locomotion.AddWalkableLayer(NavMeshLayers.JustAgents);
        component.RegisterEventCallback(AIEventNotification.Killed, new AIEntityEvent(this.NotifyDeath));
        component.RegisterEventCallback(AIEventNotification.Bribed, new AIEntityEvent(this.NotifyDeath));
        component.RegisterEventCallback(AIEventNotification.Despawn, new AIEntityEvent(this.NotifyDeath));
        component.RegisterEventCallback(AIEventNotification.Unhijacked, new AIEntityEvent(this.NotifyDeath));
        this.UpdateEnergyRegen();
        ModdedAbilityHijack.HijackedEntities.Add(component);
    }