public override bool OnCheck() { var packages = blackboard.Get <List <GameObject> > (GameRule.VAR_AvailableExpressPackages); var playerHand = blackboard.Get <Hand> (GameRule.VAR_PlayerHand); foreach (var package in packages) { if (!includePlayerHand && package != playerHand.equipped) { if (checkDistance(package.transform)) { return(true); } } if (includePlayerHand && package == playerHand.equipped) { if (checkDistance(package.transform)) { return(true); } } } return(false); }
private void onExpressPackageGenerated(GameObject pack) { var av = worldBlackboard.Get <List <GameObject> > (VAR_AvailableExpressPackages); av.Add(pack); buildCPU(); }
public override bool OnCheck () { target = blackboard.Get< Transform > ( KEY_Target ); if ( target == null ) { Debug.Log ( $"CheckTargetInRange: {KEY_Target} is null." ); return false; } Vector3 centerOffset = Vector3.zero; if ( statCollection.ContainStat ( GlobalSymbol.CENTER_OFFSET_X ) ) { centerOffset.x = statCollection.GetStatValue ( GlobalSymbol.CENTER_OFFSET_X ); } if ( statCollection.ContainStat ( GlobalSymbol.CENTER_OFFSET_Y ) ) { centerOffset.y = statCollection.GetStatValue ( GlobalSymbol.CENTER_OFFSET_Y ); } bool xOK = string.IsNullOrEmpty ( KEY_RANGE_X ) || Mathf.Abs ( target.position.x - ( transform.position.x + centerOffset.x ) ) < statCollection.GetStatValue ( KEY_RANGE_X ); bool yOK = string.IsNullOrEmpty ( KEY_RANGE_Y ) || Mathf.Abs ( target.position.y - ( transform.position.y + centerOffset.y ) ) < statCollection.GetStatValue ( KEY_RANGE_Y ); // Debug.Log ( $"CheckTargetInRange: xOK {target} => {transform} {target.position.x} - {( transform.position.x + centerOffset.x )} = {Mathf.Abs ( target.position.x - ( transform.position.x + centerOffset.x ) )} < {statCollection.GetStatValue ( KEY_RANGE_X )} {xOK} yOK {KEY_RANGE_Y} {yOK}" ); return xOK && yOK; }
private void OnGUI() { var target = worldBlackboard.Get <Transform> (GameRule.VAR_Player); GUI.Label(new Rect(0, 20, 400, 100), $"player distance:{Mathf.Abs ( target.transform.position.x - transform.position.x )}, {Mathf.Abs ( target.transform.position.y - transform.position.y )}"); target = worldBlackboard.Get <Transform> (GameRule.VAR_ExpressPackageGenerator); GUI.Label(new Rect(0, 40, 400, 100), $"Generator distance:{Mathf.Abs ( target.transform.position.x - transform.position.x )}, {Mathf.Abs ( target.transform.position.y - transform.position.y )}"); target = worldBlackboard.Get <Transform> (GameRule.VAR_FillPiter); GUI.Label(new Rect(0, 60, 400, 100), $"Piter distance:{Mathf.Abs ( target.transform.position.x - transform.position.x )}, {Mathf.Abs ( target.transform.position.y - transform.position.y )}"); target = worldBlackboard.Get <Transform> (GameRule.VAR_EscapePoint); GUI.Label(new Rect(0, 80, 400, 100), $"EscapePoint distance:{Mathf.Abs ( target.transform.position.x - transform.position.x )}, {Mathf.Abs ( target.transform.position.y - transform.position.y )}"); }
public override bool OnCheck() { target = blackboard.Get <Transform> ("Target"); if (target == null) { return(false); } return(target.position.y > gameObject.transform.position.y); }
public override bool OnCheck() { var target = blackboard.Get <Transform> (KEY_Target); if (target == null) { return(false); } else { hand = target.GetComponentInChildren <Hand>(); } return(hand != null && hand.equipped != null && hand.equipped.GetType() == typeof(ExpressPackage)); }
public override bool OnCheck() { return(OperationTools.Compare(TimeManager.EnemyTime - blackboard.Get <float> (key), value, checkType, 0)); }