Exemple #1
0
    public void ActivateTriggerDetection(UnitAI _sender, bool _activate)
    {
        CurAi       = _sender;
        equip       = CurAi.GetComponent <UnitEquip>();
        unit        = CurAi.GetComponent <Unit>();
        senderTrans = _sender.transform;

        switch (triggerType)
        {
        case TriggerType.OnEnter:
            DoEnterDetection(_activate);
            break;

        case TriggerType.OnExit:
            DoExitDetection(_activate);
            break;

        case TriggerType.OnStay:
            DoStayDetection(_activate);
            break;

        case TriggerType.ValueAmount:
            DoValueAmountDetection(_activate);
            break;
        }
    }
Exemple #2
0
    public void DoEvent(UnitAITrigger _trigger, int _index, Collider _col = null)
    {
        curAI = _trigger.CurAi;
        if (!equip)
        {
            equip = curAI.GetComponent <UnitEquip>();
        }
        index    = _index;
        finished = false;

        if (_col)
        {
            curTarget = _col;
        }

        if (startType == StartType.Instant)
        {
            StartEvent();
        }
        else if (startType == StartType.WaitForPreviousToFinish && index > 0)
        {
            if (waitRoutine != null)
            {
                curAI.StopCoroutine(waitRoutine);
            }

            waitRoutine = curAI.StartCoroutine(StartWaitForPrevious(_trigger));
        }
    }
Exemple #3
0
    public virtual void GetProperties()
    {
        detectZones    = sourceRef.FindProperty("detectZones");
        unitAIEvents   = sourceRef.FindProperty("unitAIEvents");
        unitAITriggers = unitAIEvents.FindPropertyRelative("unitAITriggers");

        equipSource = source.GetComponent <UnitEquip>();
    }
    protected override void GetProperties(SerializedProperty _property)
    {
        base.GetProperties(_property);

        boldStyle = new GUIStyle
        {
            fontStyle = FontStyle.Bold,
        };

        //get property values
        unitAITriggers = _property.FindPropertyRelative("unitAITriggers");
        source         = fieldInfo.GetValue(_property.serializedObject.targetObject) as UnitAITriggerContainer;
        triggerSource  = source.unitAITriggers;
        aiSource       = _property.serializedObject.targetObject as UnitAI;
        equipSource    = aiSource.GetComponent <UnitEquip>();
    }