Beispiel #1
0
    //
    public bool CanDestoryFrontCar(string p_target_id)
    {
        if (!carJSON.GetField("target_vehecle").HasField(p_target_id))
        {
            return(false);
        }
        float possibility = carJSON.GetField("target_vehecle").GetField(p_target_id).n;

        return(UtilityColl.FlipCoin(possibility));
    }
Beispiel #2
0
    private void SetCarSpawnGenerator(float p_streetBottomPosition, int p_carSlot)
    {
        float centerAxisX = streetObject.transform.position.x,
              halfWidth   = (streetObject.size.x / 2),
              xLeftPos    = centerAxisX - halfWidth,
              xRightPos   = centerAxisX + halfWidth;

        for (int i = 0; i < p_carSlot; i++)
        {
            bool isFaceLeft = UtilityColl.FlipCoin(0.5f);

            float   carSpawnYPos = p_streetBottomPosition + (slotheight * i) + (slotheight / 2f);
            Vector2 carSpawnPos  = new Vector2((isFaceLeft) ?  xLeftPos : xRightPos,
                                               carSpawnYPos);
            Vector2 carDirection = (isFaceLeft) ?  Vector2.right :Vector2.left;

            CarSpawn gCarSpawn = CreateCarSpawn(carSpawnPos, carDirection);
            // Vector2 carSpawnPosition,
            // spawnDir = ;
            carSpawnPointList.Add(gCarSpawn);
        }
    }