コード例 #1
0
    /*
     * Function: GetState
     * ----------------------------
     *   A method to get the current state of the game, which is then transmitted to the server
     *
     *   return: a string containing the current state of the game
     *
     */
    private string GetState()
    {
        string state = "";

        //Get current state
        state += EnemyTeamFlagInSight().ToString();
        state += " " + FriendlyTeamFlagInSight().ToString();
        state += " " + IsDamaged.ToString();
        state += " " + HasFlag.ToString();
        state += " " + IsDead.ToString();
        state += " " + FriendlyFlagTaken.ToString();
        state += " " + EnemyFlagTaken.ToString();
        state += " " + NumbEnemiesSpotted();
        state += " " + GetAgentLowHealth().ToString();
        state += " " + LowestHealthEnemyHigherThanAgent().ToString();
        state += " " + TotalEnemyHealthHigherThanAgent().ToString();
        //state += " " + IsMyTeamWinning().ToString();
        return(state);
    }
コード例 #2
0
    override protected void Start()
    {
        root          = new Sequence();
        seqDeath      = new Sequence();
        seqChase      = new Sequence();
        seqAttack     = new Sequence();
        selMove       = new Selector();
        selChase      = new Selector();
        patrol        = new Patrol(this);
        isDead        = new IsDead(this);
        death         = new Death(this);
        inSight       = new InSight(this);
        chase         = new Chase(this);
        isDamaged     = new IsDamaged(this);
        inAttackRange = new InAttackRange(this);
        attack        = new Attack(this);

        base.Start();
        Init();
        StartCoroutine("BehaviorProcess");
    }
コード例 #3
0
        public bool Validate()
        {
            Regex alphabetic   = new Regex(@"^[\s\p{L}]+$");
            Regex numeric      = new Regex("^[0-9]*$");
            Regex mail         = new Regex(@"^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$");
            Regex alphanumeric = new Regex(@"^[\s\p{L}0-9]+$");

            if (string.IsNullOrEmpty(DrivenDistance.ToString()) || (!numeric.IsMatch(DrivenDistance.ToString()) ||
                                                                    string.IsNullOrEmpty(IsDamaged.ToString()) ||
                                                                    string.IsNullOrEmpty(ReturnDate.ToString())))
            {
                return(false);
            }

            if (ReturnDate > DateTime.Now)
            {
                return(false);
            }
            return(true);
        }