Exemple #1
0
 public SC2APIProtocol.Action BuildSupply(Unit cc)
 {
     if (!coolDownCommand.IsDelayed("BuildSupply"))
     {
         coolDownCommand.Add(new CoolDownCommandData()
         {
             key = "BuildSupply", finishStep = gameLoop + 10
         });
         SC2APIProtocol.Action answer = CreateAction(cc, ABILITY_ID.BUILD_SUPPLYDEPOT);
         List <Point2D>        poses  = FindPlaceables((int)cc.Pos.X, (int)cc.Pos.Y, 10, UNIT_TYPEID.TERRAN_SUPPLYDEPOT, true);
         if (poses.Count > 0)
         {
             ScoreDatas scores = new ScoreDatas();
             foreach (Point2D p in poses)
             {
                 float dist = cc.Pos.Dist(p.X, p.Y);
                 scores.Add(new ScoreData {
                     data = p, score = dist
                 });
             }
             scores.Sort();
             scores.Reverse();
             //Point2D pos = FindPlaceable((int)cc.Pos.X, (int)cc.Pos.Y, 10,UNIT_TYPEID.TERRAN_SUPPLYDEPOT,true);
             Point2D pos = (Point2D)scores[0].data;
             if (pos != null)
             {
                 logDebug("BuildSupply at " + pos.ToString());
                 answer.ActionRaw.UnitCommand.TargetWorldSpacePos = pos;
                 return(answer);
             }
         }
     }
     return(null);
 }
Exemple #2
0
    public void FollowScoreOf(IPlatformer2DUserControl control, HPScript hpScript)
    {
        CurrentScores.Add(new PlayerScoreTracker {
            CurrentScore = 0, Player = control.m_PlayerData
        });
        var data = new ScoreData()
        {
            HpScript = hpScript, Platformer2DUserControl = control
        };

        data.HpScript.Dead += HpScript_Dead;
        ScoreDatas.Add(data);
    }