Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(quitKey))
        {
            timer = 0;
        }

        if (Input.GetKey(quitKey))
        {
            timer += Time.deltaTime;

            var tempColor = dark.color;
            tempColor.a = (timer / holdTime);
            dark.color  = tempColor;

            if (timer > holdTime)
            {
                print(BaneTools.ColorString("Quit Successfully", BaneTools.Color255(255, 0, 0)));
                Application.Quit();
            }
        }

        if (Input.GetKeyUp(quitKey))
        {
            var tempColor = dark.color;
            tempColor.a = 0;
            dark.color  = tempColor;
        }
    }
Example #2
0
    void TargetReached()
    {
        targetReached = true;
        print(string.Format(BaneTools.ColorString("Plate Target Reached!", BaneTools.Color255(255, 100, 100))));

        //Do stuff here
        result.Invoke();
    }
 //Func<Vector3, Vector3> GetDestinationInTotem()
 //{
 //    Func<Vector3, Vector3> fn = (v) =>
 //    {
 //        if (!localTotem)
 //        {
 //            return v;
 //        }
 //        Vector3 totemPos = localTotem.transform.position;
 //        float destinationDist = Vector3.Distance(totemPos, v);
 //        if (destinationDist > localTotem.radius)
 //        {
 //            // position + direction.normalized * radius 0 shortens destination to point on totem radius
 //            return totemPos + (v - totemPos).normalized * localTotem.radius;
 //        }
 //        return v;
 //    };
 //    return fn;
 //}
 public void TryExecutePattern(Pattern incomingPattern, SenseMemoryFactory.SMData _data)
 {
     if (ai.debugBehaviour)
     {
         string debug = _data.inspectionPoints.Count > 0 ? string.Format(BaneTools.ColorString("iPs: " + _data.inspectionPoints.Count + ", tLS: " + _data.targetLastSeen + ", tars: " + _data.targets.Count, Color.yellow)) : "iPs: " + _data.inspectionPoints.Count + ", tLS: " + _data.targetLastSeen + ", tars: " + _data.targets.Count;
         Debug.Log(debug);
     }
     //remove currentPattern if it has stopped
     if (currentPattern && !currentPattern.isRunning)
     {
         currentPattern = null;
     }
     // if there is no pattern running
     if (!currentPattern)
     {
         if (ai.debugBehaviour)
         {
             Debug.Log(string.Format(BaneTools.ColorString("NEW Pattern: " + incomingPattern + ", OLD Pattern ended", Color.red)));
         }
         incomingPattern.StartPatternWith(ai, _data);
         currentPattern = incomingPattern;
         return;
     }
     // if incoming pattern is different and current pattern is interuptable
     if (incomingPattern != currentPattern && currentPattern.isInteruptable)
     {
         if (ai.debugBehaviour)
         {
             Debug.Log(string.Format(BaneTools.ColorString("NEW Pattern: " + incomingPattern + ", OLD Pattern: " + currentPattern, Color.green)));
         }
         currentPattern.KillPattern(ai);
         incomingPattern.StartPatternWith(ai, _data);
         currentPattern = incomingPattern;
         return;
     }
     // if precedence matters for current pattern && incoming has higher or equal precedence, run incoming
     if (currentPattern.notePrecedence && incomingPattern.patternType.precedence >= currentPattern.patternType.precedence)
     {
         if (ai.debugBehaviour)
         {
             Debug.Log(string.Format(BaneTools.ColorString("NEW Pattern: " + incomingPattern + ", OLD Pattern: " + currentPattern, Color.green)));
         }
         currentPattern.KillPattern(ai);
         incomingPattern.StartPatternWith(ai, _data);
         currentPattern = incomingPattern;
         return;
     }
     if (ai.debugBehaviour)
     {
         Debug.Log("Update Pattern: " + currentPattern);
     }
     currentPattern.UpdatePattern(ai, _data);
 }
Example #4
0
 public void BulletAlert(Vector3 shotOrigin)
 {
     Debug.Log(string.Format(BaneTools.ColorString("bullet allert ai", Color.magenta)));
     // sort new inspection point into ordered list (from closest to player onward)
     if (sMF.inspectionPoints.Count == 0)
     {
         sMF.inspectionPoints.Add(shotOrigin);
     }
     else
     {
         for (int i = 0; i < sMF.inspectionPoints.Count; i++)
         {
             if (Vector3.Distance(transform.position, shotOrigin) < Vector3.Distance(transform.position, sMF.inspectionPoints[i]))
             {
                 return;
             }
         }
     }
     // Re-reun refreshed Ai
     MakeDecisionBasedOnSenses();
 }
    private void SelectWeapon(int index)
    {
        DisableAllWeapons();

        // cycle through weapons until equipped weapon is selected
        while (!weapons[index].isEquipped)
        {
            index++;
            if (index >= weapons.Length)
            {
                Debug.Log(BaneTools.ColorString("You Have Not Equipped Any Of The Weapons! (is Equipped bool)", Color.red));
                currentWeapon = null;
                return;
            }
        }
        currentWeapon = weapons[index];
        currentWeapon.gameObject.SetActive(true);

        // Note (Manny): Update it here for observers
        currentWeaponIndex = index;
        currentWeapon.UpdateAmmoDisplay();
    }
Example #6
0
 public void TestSuccess()
 {
     print(string.Format(BaneTools.ColorString("Called successfully!", BaneTools.Color255(100, 255, 100))));
 }