public void triggerHit(TRIGGER t)
    {
        if (co_audio != null)
        {
            StopCoroutine(co_audio);
        }

        switch (t)
        {
        case TRIGGER.INTRO:
            //trigger animation
            JimAC.triggerIntroRant();
            //trigger audio
            co_audio = StartCoroutine(PlaySingleAudio(DM.getSingleClips("Intro"), false));
            break;

        case TRIGGER.COPS:
            //trigger animation
            copsAnim = true;
            JimAC.triggerIntroCops();
            //trigger audio
            co_audio = StartCoroutine(PlaySingleAudio(DM.getSingleClips("CopsHere"), true));
            //start the grammar recognition
            SC.startGrammar();
            break;
        }
    }
    }                                               // Purely UI

    /*
     * general stuff
     */
    public AbilityManagerPrototype(float iCooldown, int iEnergyCost, TRIGGER iTrigger, Effect iEffect, string iName = "", string iEffectDisplay = "")
    {
        _cooldown      = iCooldown;
        _energyCost    = iEnergyCost;
        _trigger       = iTrigger;
        _effect        = iEffect;
        _effectDisplay = iEffectDisplay;
        _name          = iName;
    }
Exemple #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            Debug.Log("Player collected this!!");
            TRIGGER?.Invoke(type);

            //for object pool
            gameObject.SetActive(false);
        }
    }
Exemple #4
0
 ///Returns if a conditional action is ready at the specified range.
 public bool IsReadyConditionalAtRange(TRIGGER condition, float target_distance)
 {
     if (m_action_trigger != condition)
     {
         return(false);
     }
     if (m_requires_target && target_distance >= m_range)
     {
         return(false);
     }
     return(m_action_timer.IsReady());
 }
Exemple #5
0
 ///Attempt all actions triggered by this event.
 public void AttemptAllActions(TRIGGER trigger)
 {
     foreach (ACTION available_action in m_entity.m_actions)
     {
         foreach (GAction action in m_actions)
         {
             if (action.m_action_timer != null && action.m_action_timer.m_action_id == available_action)
             {
                 AttemptAction(available_action, trigger);
             }
         }
     }
 }
Exemple #6
0
    /// <summary>
    /// Returns true on the frame the trigger passes the trigger value
    /// </summary>
    /// <param name="btn"></param>
    /// <returns></returns>
    public static bool GetTriggerAxisDown(TRIGGER trig, float triggerValue)
    {
        bool value = false;

        string input = PAD_PREFIX;

        switch (trig)
        {
        case TRIGGER.L:
            input += TRIGGERS_PREFIX + L;
            break;

        case TRIGGER.R:
            input += TRIGGERS_PREFIX + R;
            break;
        }

        bool test = Input.GetAxis(input) >= triggerValue;

        if (test)
        {
            if (!_axisValues.ContainsKey(input))
            {
                _axisValues.Add(input, true);
                value = true;
            }
            else
            {
                value = !_axisValues[input];
                _axisValues[input] = true;
            }
        }
        else
        {
            if (!_axisValues.ContainsKey(input))
            {
                _axisValues.Add(input, false);
            }
            else
            {
                _axisValues[input] = false;
            }

            value = false;
        }

        return(value);
    }
Exemple #7
0
    ///This will begin an action - if possible.
    public void AttemptAction(ACTION action, TRIGGER trigger)
    {
        GAction g_action = GetAction(action);

        if (g_action == null)
        {
            return;
        }

        float target_distance = Mathf.Infinity;

        if (g_action.m_is_hostile)
        {
            if (g_action.m_requires_target && !HasHostileTarget())
            {
                return;
            }
            if (m_main_hostile_target != null)
            {
                target_distance = Vector3.Distance(
                    transform.position,
                    m_main_hostile_target.transform.position
                    );
            }
        }
        else
        {
            if (g_action.m_requires_target && !HasFriendlyTarget())
            {
                return;
            }
            if (m_main_hostile_target != null)
            {
                target_distance = Vector3.Distance(
                    transform.position,
                    m_main_friendly_target.transform.position);
            }
        }

        if (g_action.IsReadyConditionalAtRange(trigger, target_distance))
        {
            g_action.m_action_timer.AttemptAction();
            //m_entity.m_actor.PlayNormal(g_action.m_name + "Windup");
        }
    }
Exemple #8
0
        public uint TriggerColmask(Parse parse, ExprList changes, bool isNew, TRIGGER trtm, Table table, OE orconf)
        {
            TK   op      = (changes != null ? TK.UPDATE : TK.DELETE);
            int  isNewId = (isNew ? 1 : 0);
            uint mask    = 0;

            for (Trigger p = this; p != null; p = p.Next)
            {
                if (p.OP == op && (trtm & p.TRtm) != 0 && CheckColumnOverlap(p.Columns, changes))
                {
                    TriggerPrg prg = GetRowTrigger(parse, p, table, orconf);
                    if (prg != null)
                    {
                        mask |= prg.Colmasks[isNewId];
                    }
                }
            }
            return(mask);
        }
Exemple #9
0
    /// <summary>
    /// Returns true on the frame the trigger passes the trigger value
    /// </summary>
    /// <param name="btn"></param>
    /// <returns></returns>
    public static bool GetTriggerAxis(TRIGGER trig, float triggerValue)
    {
        string input = PAD_PREFIX;

        switch (trig)
        {
        case TRIGGER.L:
            input += TRIGGERS_PREFIX + L;
            break;

        case TRIGGER.R:
            input += TRIGGERS_PREFIX + R;
            break;
        }

        bool test = Input.GetAxis(input) >= triggerValue;

        return(test);
    }
Exemple #10
0
        public void CodeRowTrigger(Parse parse, TK op, ExprList changes, TRIGGER trtm, Table table, int reg, OE orconf, int ignoreJump)
        {
            Debug.Assert(op == TK.UPDATE || op == TK.INSERT || op == TK.DELETE);
            Debug.Assert(trtm == TRIGGER.BEFORE || trtm == TRIGGER.AFTER);
            Debug.Assert((op == TK.UPDATE) == (changes != null));

            for (Trigger p = this; p != null; p = p.Next)
            {
                // Sanity checking:  The schema for the trigger and for the table are always defined.  The trigger must be in the same schema as the table or else it must be a TEMP trigger.
                Debug.Assert(p.Schema != null);
                Debug.Assert(p.TabSchema != null);
                Debug.Assert(p.Schema == p.TabSchema || p.Schema == parse.Ctx.DBs[1].Schema);

                // Determine whether we should code this trigger
                if (p.OP == op && p.TRtm == trtm && CheckColumnOverlap(p.Columns, changes))
                {
                    p.CodeRowTriggerDirect(parse, table, reg, orconf, ignoreJump);
                }
            }
        }
Exemple #11
0
        public static Trigger TriggersExist(Parse parse, Table table, TK op, ExprList changes, out TRIGGER maskOut)
        {
            TRIGGER mask = 0;
            Trigger list = null;

            if ((parse.Ctx.Flags & Context.FLAG.EnableTrigger) != 0)
            {
                list = List(parse, table);
            }
            Debug.Assert(list == null || !E.IsVirtual(table));
            for (Trigger p = list; p != null; p = p.Next)
            {
                if (p.OP == op && CheckColumnOverlap(p.Columns, changes))
                {
                    mask |= p.TRtm;
                }
            }
            maskOut = mask;
            return(mask != 0 ? list : null);
        }
/******************************************************
 * Function: GetTrigger
 * Parameters: 
 *		whichPlayer - Players ONE through FOUR
 *		whichTrigger - Left or Right
 * Return:
 *		Returns the float value of the desired trigger
 *		for the desired player
******************************************************/
	public static float GetTrigger(PLAYER_NUMBER whichPlayer, TRIGGER whichTrigger)
	{
		float triggerValue = 0.0f;

		string inputToCheck = "";

#if UNITY_ANDROID
		inputToCheck += "A_";
#endif

		inputToCheck += "P" + ((int)whichPlayer).ToString() + "_Trigger_";

		switch (whichTrigger)
		{
			case TRIGGER.LEFT:
				inputToCheck += "L";
				break;
			case TRIGGER.RIGHT:
				inputToCheck += "R";
				break;
			default:
				break;
		}
		triggerValue = Input.GetAxis(inputToCheck);

#if UNITY_ANDROID
		inputToCheck.Replace('A', 'F');
		float fireTVValue = Input.GetAxis(inputToCheck);
		if (Mathf.Abs(triggerValue) < Mathf.Abs(fireTVValue))
		{
			triggerValue = fireTVValue;
		}
#endif

		return triggerValue;
	}
Exemple #13
0
 public uint TriggerColmask(Parse parse, ExprList changes, bool isNew, TRIGGER trtm, Table table, OE orconf)
 {
     TK op = (changes != null ? TK.UPDATE : TK.DELETE);
     int isNewId = (isNew ? 1 : 0);
     uint mask = 0;
     for (Trigger p = this; p != null; p = p.Next)
         if (p.OP == op && (trtm & p.TRtm) != 0 && CheckColumnOverlap(p.Columns, changes))
         {
             TriggerPrg prg = GetRowTrigger(parse, p, table, orconf);
             if (prg != null)
                 mask |= prg.Colmasks[isNewId];
         }
     return mask;
 }
Exemple #14
0
        public void CodeRowTrigger(Parse parse, TK op, ExprList changes, TRIGGER trtm, Table table, int reg, OE orconf, int ignoreJump)
        {
            Debug.Assert(op == TK.UPDATE || op == TK.INSERT || op == TK.DELETE);
            Debug.Assert(trtm == TRIGGER.BEFORE || trtm == TRIGGER.AFTER);
            Debug.Assert((op == TK.UPDATE) == (changes != null));

            for (Trigger p = this; p != null; p = p.Next)
            {
                // Sanity checking:  The schema for the trigger and for the table are always defined.  The trigger must be in the same schema as the table or else it must be a TEMP trigger.
                Debug.Assert(p.Schema != null);
                Debug.Assert(p.TabSchema != null);
                Debug.Assert(p.Schema == p.TabSchema || p.Schema == parse.Ctx.DBs[1].Schema);

                // Determine whether we should code this trigger
                if (p.OP == op && p.TRtm == trtm && CheckColumnOverlap(p.Columns, changes))
                    p.CodeRowTriggerDirect(parse, table, reg, orconf, ignoreJump);
            }
        }
Exemple #15
0
 public static Trigger TriggersExist(Parse parse, Table table, TK op, ExprList changes, out TRIGGER maskOut)
 {
     TRIGGER mask = 0;
     Trigger list = null;
     if ((parse.Ctx.Flags & Context.FLAG.EnableTrigger) != 0)
         list = List(parse, table);
     Debug.Assert(list == null || !E.IsVirtual(table));
     for (Trigger p = list; p != null; p = p.Next)
         if (p.OP == op && CheckColumnOverlap(p.Columns, changes))
             mask |= p.TRtm;
     maskOut = mask;
     return (mask != 0 ? list : null);
 }
 public void Change(bool b = true)
 {
     TRIGGER?.Invoke(b);
 }