示例#1
0
    new void Awake()
    {
        base.Awake();

        //// initialize focus
        noiseStorage = RegisterSenseInBlackboard("noiseStorage");
    }
示例#2
0
    new void Awake()
    {
        base.Awake();

        //// initialize focus
        painStorage = RegisterSenseInBlackboard("painStorage");
        var healthController = GetComponentInParent <HealthController>();

        healthController.onDamageCallback += (data) =>
        {
            if (!tPain.IsReadyRestart())
            {
                return;
            }

            MemoryEvent ev = new MemoryEvent();
            ev.exactPosition = data.position;
            ev.forward       = data.direction;
            // we have no information about hit velocity; just assume it is stationary
            ev.velocity = Vector2.zero;
            ev.lifetimeTimer.Restart();

            painStorage.PerceiveEvent(ev);

            Debug.DrawRay(ev.position, Vector3.up, Color.blue, 0.25f);
        };
    }
示例#3
0
    private new void Awake()
    {
        base.Awake();

        // cache transform
        transform = base.transform;

        enemyStorage   = RegisterSenseInBlackboard("enemyStorage");
        allyStorage    = RegisterSenseInBlackboard("allyStorage");
        neutralStorage = RegisterSenseInBlackboard("neutralStorage");
    }
    public static FocusFilterStorage GetFocusTouch(AiBehaviourController controller)
    {
        const float timeSortScale     = 1.0f;
        const float distanceSortScale = 1.0f;

        const string storageName = "touchStorage";
        const string focusName   = "touchFocus";

        StimuliStorage storage = controller.GetBlackboardValue <StimuliStorage>(storageName)?.value;

        if (storage == null)
        {
            return(null);
        }

        GenericBlackboard.InitializeMethod <FocusFilterStorage> initializeMethod =
            () => new FocusFilterStorage(controller.transform, storage, distanceSortScale, timeSortScale);
        return(controller.InitBlackboardValue(focusName, initializeMethod).value);
    }