コード例 #1
0
    public void SetPlayerOrigineZone(int playerId, Zone zone)
    {
        GameData game = GameData.Instance;

        if (playerId < 0 || playerId > 3)
        {
            return;
        }
        players[playerId].origine = zone;

        if (playerId == GameData.Instance.myId)
        {
            game.myFlag     = CentralMap.GetMap(zone);
            game.myFlagZone = zone;
        }
        else
        {
            game.enemyFlag     = CentralMap.GetMap(zone);
            game.enemyFlagZone = zone;
        }

        if (game.myFlag != null && game.enemyFlag != null)
        {
            ShortestWayNode swn = null;
            game.enemyFlag.TryGetValue(game.myFlagZone.id, out swn);
            NodeZone nz = swn.GetNextNodeZone();
            game.enemyDistance = nz.cost;
            Player.DebugLog("Dist based:" + game.enemyDistance);
        }
    }
コード例 #2
0
    public void SetPlayerOrigineZone(bool isEnemy, Zone zone)
    {
        if (isEnemy)
        {
            enemyFlagLocalisation = zone;
            enemyFlagPath         = CentralMap.GetMap(zone);
        }
        else
        {
            myFlagLocalisation = zone;
            myFlagPath         = CentralMap.GetMap(zone);
        }


        if (myFlagLocalisation != null && enemyFlagPath != null)
        {
            ShortestWayNode swn = null;
            enemyFlagPath.TryGetValue(myFlagLocalisation.id, out swn);
            NodeZone nz = swn.GetNextNodeZone();
            enemyDistance = nz.cost;
        }
    }